mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 11:56:58 +00:00
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()
This commit is contained in:
@@ -537,27 +537,27 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
|
||||
if (permitted && (!whole || num_threads < 2))
|
||||
wchan = !task_is_running(task);
|
||||
|
||||
scoped_seqlock_read (&sig->stats_lock, ss_lock_irqsave) {
|
||||
cmin_flt = sig->cmin_flt;
|
||||
cmaj_flt = sig->cmaj_flt;
|
||||
cutime = sig->cutime;
|
||||
cstime = sig->cstime;
|
||||
cgtime = sig->cgtime;
|
||||
scoped_guard(rcu) {
|
||||
scoped_seqlock_read (&sig->stats_lock, ss_lock_irqsave) {
|
||||
cmin_flt = sig->cmin_flt;
|
||||
cmaj_flt = sig->cmaj_flt;
|
||||
cutime = sig->cutime;
|
||||
cstime = sig->cstime;
|
||||
cgtime = sig->cgtime;
|
||||
|
||||
if (whole) {
|
||||
struct task_struct *t;
|
||||
if (whole) {
|
||||
struct task_struct *t;
|
||||
|
||||
min_flt = sig->min_flt;
|
||||
maj_flt = sig->maj_flt;
|
||||
gtime = sig->gtime;
|
||||
min_flt = sig->min_flt;
|
||||
maj_flt = sig->maj_flt;
|
||||
gtime = sig->gtime;
|
||||
|
||||
rcu_read_lock();
|
||||
__for_each_thread(sig, t) {
|
||||
min_flt += t->min_flt;
|
||||
maj_flt += t->maj_flt;
|
||||
gtime += task_gtime(t);
|
||||
__for_each_thread(sig, t) {
|
||||
min_flt += t->min_flt;
|
||||
maj_flt += t->maj_flt;
|
||||
gtime += task_gtime(t);
|
||||
}
|
||||
}
|
||||
rcu_read_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1224,7 +1224,7 @@ struct ss_tmp {
|
||||
spinlock_t *lock_irqsave;
|
||||
};
|
||||
|
||||
static inline void __scoped_seqlock_cleanup(struct ss_tmp *sst)
|
||||
static __always_inline void __scoped_seqlock_cleanup(struct ss_tmp *sst)
|
||||
{
|
||||
if (sst->lock)
|
||||
spin_unlock(sst->lock);
|
||||
@@ -1252,7 +1252,7 @@ static inline void __scoped_seqlock_bug(void) { }
|
||||
extern void __scoped_seqlock_bug(void);
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
static __always_inline void
|
||||
__scoped_seqlock_next(struct ss_tmp *sst, seqlock_t *lock, enum ss_state target)
|
||||
{
|
||||
switch (sst->state) {
|
||||
|
||||
Reference in New Issue
Block a user