Skip to content

Commit 92fc1f1

Browse files
committed
Merge tag 'locking-urgent-2025-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking fixes from Ingo Molnar: "Two fixes related to recent introduction of scoped_seqlock_read(): - Fix compiler build failures when a particular .config and compiler build options variant doesn't result in the expected removal of unused, catch-bugs portions of scoped_seqlock_read() by the inliner at build time, and cause a linker fail even in correct code - Match read-locking order in do_task_stat() and do_io_accounting(). The inconsistency here was harmless but unnecessary" * tag 'locking-urgent-2025-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: seqlock: Cure some more scoped_seqlock() optimization fails seqlock, procfs: Match scoped_seqlock_read() critical section vs. RCU ordering in do_task_stat() to do_io_accounting()
2 parents 5e5ea7f + 90dfeef commit 92fc1f1

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

fs/proc/array.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -537,27 +537,27 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
537537
if (permitted && (!whole || num_threads < 2))
538538
wchan = !task_is_running(task);
539539

540-
scoped_seqlock_read (&sig->stats_lock, ss_lock_irqsave) {
541-
cmin_flt = sig->cmin_flt;
542-
cmaj_flt = sig->cmaj_flt;
543-
cutime = sig->cutime;
544-
cstime = sig->cstime;
545-
cgtime = sig->cgtime;
546-
547-
if (whole) {
548-
struct task_struct *t;
549-
550-
min_flt = sig->min_flt;
551-
maj_flt = sig->maj_flt;
552-
gtime = sig->gtime;
553-
554-
rcu_read_lock();
555-
__for_each_thread(sig, t) {
556-
min_flt += t->min_flt;
557-
maj_flt += t->maj_flt;
558-
gtime += task_gtime(t);
540+
scoped_guard(rcu) {
541+
scoped_seqlock_read (&sig->stats_lock, ss_lock_irqsave) {
542+
cmin_flt = sig->cmin_flt;
543+
cmaj_flt = sig->cmaj_flt;
544+
cutime = sig->cutime;
545+
cstime = sig->cstime;
546+
cgtime = sig->cgtime;
547+
548+
if (whole) {
549+
struct task_struct *t;
550+
551+
min_flt = sig->min_flt;
552+
maj_flt = sig->maj_flt;
553+
gtime = sig->gtime;
554+
555+
__for_each_thread(sig, t) {
556+
min_flt += t->min_flt;
557+
maj_flt += t->maj_flt;
558+
gtime += task_gtime(t);
559+
}
559560
}
560-
rcu_read_unlock();
561561
}
562562
}
563563

include/linux/seqlock.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ struct ss_tmp {
12241224
spinlock_t *lock_irqsave;
12251225
};
12261226

1227-
static inline void __scoped_seqlock_cleanup(struct ss_tmp *sst)
1227+
static __always_inline void __scoped_seqlock_cleanup(struct ss_tmp *sst)
12281228
{
12291229
if (sst->lock)
12301230
spin_unlock(sst->lock);
@@ -1252,7 +1252,7 @@ static inline void __scoped_seqlock_bug(void) { }
12521252
extern void __scoped_seqlock_bug(void);
12531253
#endif
12541254

1255-
static inline void
1255+
static __always_inline void
12561256
__scoped_seqlock_next(struct ss_tmp *sst, seqlock_t *lock, enum ss_state target)
12571257
{
12581258
switch (sst->state) {

0 commit comments

Comments
 (0)