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_task_stat() 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
b76f72be 488f48b3

+2 -7
+2 -7
fs/proc/array.c
··· 481 481 unsigned long flags; 482 482 int exit_code = task->exit_code; 483 483 struct signal_struct *sig = task->signal; 484 - unsigned int seq = 1; 485 484 486 485 state = *get_task_state(task); 487 486 vsize = eip = esp = 0; ··· 537 538 if (permitted && (!whole || num_threads < 2)) 538 539 wchan = !task_is_running(task); 539 540 540 - do { 541 - seq++; /* 2 on the 1st/lockless path, otherwise odd */ 542 - flags = read_seqbegin_or_lock_irqsave(&sig->stats_lock, &seq); 543 - 541 + scoped_seqlock_read (&sig->stats_lock, ss_lock_irqsave) { 544 542 cmin_flt = sig->cmin_flt; 545 543 cmaj_flt = sig->cmaj_flt; 546 544 cutime = sig->cutime; ··· 559 563 } 560 564 rcu_read_unlock(); 561 565 } 562 - } while (need_seqretry(&sig->stats_lock, seq)); 563 - done_seqretry_irqrestore(&sig->stats_lock, seq, flags); 566 + } 564 567 565 568 if (whole) { 566 569 thread_group_cputime_adjusted(task, &utime, &stime);