Skip to content

Commit 795aab3

Browse files
oleg-nesterovPeter Zijlstra
authored andcommitted
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>
1 parent b76f72b commit 795aab3

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

fs/proc/base.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3043,21 +3043,14 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh
30433043
if (whole) {
30443044
struct signal_struct *sig = task->signal;
30453045
struct task_struct *t;
3046-
unsigned int seq = 1;
3047-
unsigned long flags;
3048-
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);
30533046

3047+
guard(rcu)();
3048+
scoped_seqlock_read (&sig->stats_lock, ss_lock_irqsave) {
30543049
acct = sig->ioac;
30553050
__for_each_thread(sig, t)
30563051
task_io_accounting_add(&acct, &t->ioac);
30573052

3058-
} while (need_seqretry(&sig->stats_lock, seq));
3059-
done_seqretry_irqrestore(&sig->stats_lock, seq, flags);
3060-
rcu_read_unlock();
3053+
}
30613054
} else {
30623055
acct = task->ioac;
30633056
}

0 commit comments

Comments
 (0)