summaryrefslogtreecommitdiff
path: root/rust/kernel/module_param.rs
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2025-12-02 10:05:10 +0100
committerIngo Molnar <mingo@kernel.org>2025-12-02 11:21:07 +0100
commit24bc5ea5c01a7695a1308ac24435810855ec71c9 (patch)
tree8e6a3a6188a6b98bd1e76ff3b978fa204c36703a /rust/kernel/module_param.rs
parent4a26e7032d7d57c998598c08a034872d6f0d3945 (diff)
seqlock, procfs: Match scoped_seqlock_read() critical section vs. RCU ordering in do_task_stat() to do_io_accounting()
There's two patterns of taking the RCU read-lock and the sig->stats_lock read-seqlock in do_task_stat() and do_io_accounting(), with a different ordering: # do_io_accounting(): guard(rcu)(); scoped_seqlock_read (&sig->stats_lock, ss_lock_irqsave) { # do_task_stat(): scoped_seqlock_read (&sig->stats_lock, ss_lock_irqsave) { ... rcu_read_lock(); The ordering is RCU-read+seqlock_read in the first case, seqlock_read+RCU-read in the second case. While technically these read locks can be taken in any order, nevertheless it's good practice to use the more intrusive lock on the inside (which is the IRQs-off section in this case), and reduces head-scratching during review when done consistently, so let's use the do_io_accounting() pattern in do_task_stat(). This will also reduce irqs-off latencies in do_task_stat() a tiny bit. Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Christian Brauner <brauner@kernel.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Link: https://patch.msgid.link/aS6rwnaPbHFCdHp1@gmail.com
Diffstat (limited to 'rust/kernel/module_param.rs')
0 files changed, 0 insertions, 0 deletions