Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

seqlock: Change do_io_accounting() to use scoped_seqlock_read()

To simplify the code and make it more readable.

[peterz: change to new interface]
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>

authored by

Oleg Nesterov and committed by
Peter Zijlstra
795aab35 b76f72be

+3 -10
+3 -10
fs/proc/base.c
··· 3043 3043 if (whole) { 3044 3044 struct signal_struct *sig = task->signal; 3045 3045 struct task_struct *t; 3046 - unsigned int seq = 1; 3047 - unsigned long flags; 3048 3046 3049 - rcu_read_lock(); 3050 - do { 3051 - seq++; /* 2 on the 1st/lockless path, otherwise odd */ 3052 - flags = read_seqbegin_or_lock_irqsave(&sig->stats_lock, &seq); 3053 - 3047 + guard(rcu)(); 3048 + scoped_seqlock_read (&sig->stats_lock, ss_lock_irqsave) { 3054 3049 acct = sig->ioac; 3055 3050 __for_each_thread(sig, t) 3056 3051 task_io_accounting_add(&acct, &t->ioac); 3057 3052 3058 - } while (need_seqretry(&sig->stats_lock, seq)); 3059 - done_seqretry_irqrestore(&sig->stats_lock, seq, flags); 3060 - rcu_read_unlock(); 3053 + } 3061 3054 } else { 3062 3055 acct = task->ioac; 3063 3056 }