From: Linus Torvalds Date: Mon, 22 Jul 2024 00:56:22 +0000 (-0700) Subject: Merge tag 'mm-nonmm-stable-2024-07-21-15-07' of git://git.kernel.org/pub/scm/linux... X-Git-Tag: v6.11-rc1~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=527eff227d4321c6ea453db1083bc4fdd4d3a3e8;p=thirdparty%2Fkernel%2Flinux.git Merge tag 'mm-nonmm-stable-2024-07-21-15-07' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Pull non-MM updates from Andrew Morton: - In the series "treewide: Refactor heap related implementation", Kuan-Wei Chiu has significantly reworked the min_heap library code and has taught bcachefs to use the new more generic implementation. - Yury Norov's series "Cleanup cpumask.h inclusion in core headers" reworks the cpumask and nodemask headers to make things generally more rational. - Kuan-Wei Chiu has sent along some maintenance work against our sorting library code in the series "lib/sort: Optimizations and cleanups". - More library maintainance work from Christophe Jaillet in the series "Remove usage of the deprecated ida_simple_xx() API". - Ryusuke Konishi continues with the nilfs2 fixes and clanups in the series "nilfs2: eliminate the call to inode_attach_wb()". - Kuan-Ying Lee has some fixes to the gdb scripts in the series "Fix GDB command error". - Plus the usual shower of singleton patches all over the place. Please see the relevant changelogs for details. * tag 'mm-nonmm-stable-2024-07-21-15-07' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (98 commits) ia64: scrub ia64 from poison.h watchdog/perf: properly initialize the turbo mode timestamp and rearm counter tsacct: replace strncpy() with strscpy() lib/bch.c: use swap() to improve code test_bpf: convert comma to semicolon init/modpost: conditionally check section mismatch to __meminit* init: remove unused __MEMINIT* macros nilfs2: Constify struct kobj_type nilfs2: avoid undefined behavior in nilfs_cnt32_ge macro math: rational: add missing MODULE_DESCRIPTION() macro lib/zlib: add missing MODULE_DESCRIPTION() macro fs: ufs: add MODULE_DESCRIPTION() lib/rbtree.c: fix the example typo ocfs2: add bounds checking to ocfs2_check_dir_entry() fs: add kernel-doc comments to ocfs2_prepare_orphan_dir() coredump: simplify zap_process() selftests/fpu: add missing MODULE_DESCRIPTION() macro compiler.h: simplify data_race() macro build-id: require program headers to be right after ELF header resource: add missing MODULE_DESCRIPTION() ... --- 527eff227d4321c6ea453db1083bc4fdd4d3a3e8 diff --cc fs/bcachefs/clock.c index df3763c18c0e1,18fab9c44b1b7..1d6b691e8da6e --- a/fs/bcachefs/clock.c +++ b/fs/bcachefs/clock.c @@@ -15,15 -24,22 +24,20 @@@ static inline void io_timer_swp(void *l void bch2_io_timer_add(struct io_clock *clock, struct io_timer *timer) { - size_t i; + const struct min_heap_callbacks callbacks = { + .less = io_timer_cmp, + .swp = io_timer_swp, + }; + spin_lock(&clock->timer_lock); - if (time_after_eq((unsigned long) atomic64_read(&clock->now), - timer->expire)) { + if (time_after_eq64((u64) atomic64_read(&clock->now), timer->expire)) { spin_unlock(&clock->timer_lock); timer->fn(timer); return; } - for (size_t i = 0; i < clock->timers.used; i++) - for (i = 0; i < clock->timers.nr; i++) ++ for (size_t i = 0; i < clock->timers.nr; i++) if (clock->timers.data[i] == timer) goto out; @@@ -34,11 -50,17 +48,16 @@@ out void bch2_io_timer_del(struct io_clock *clock, struct io_timer *timer) { - size_t i; + const struct min_heap_callbacks callbacks = { + .less = io_timer_cmp, + .swp = io_timer_swp, + }; + spin_lock(&clock->timer_lock); - for (size_t i = 0; i < clock->timers.used; i++) - for (i = 0; i < clock->timers.nr; i++) ++ for (size_t i = 0; i < clock->timers.nr; i++) if (clock->timers.data[i] == timer) { - heap_del(&clock->timers, i, io_timer_cmp, NULL); + min_heap_del(&clock->timers, i, &callbacks, NULL); break; } @@@ -120,13 -144,25 +139,20 @@@ void bch2_kthread_io_clock_wait(struct bch2_io_timer_del(clock, &wait.io_timer); } -static struct io_timer *get_expired_timer(struct io_clock *clock, - unsigned long now) +static struct io_timer *get_expired_timer(struct io_clock *clock, u64 now) { struct io_timer *ret = NULL; + const struct min_heap_callbacks callbacks = { + .less = io_timer_cmp, + .swp = io_timer_swp, + }; + - spin_lock(&clock->timer_lock); - + if (clock->timers.nr && - time_after_eq(now, clock->timers.data[0]->expire)) { ++ time_after_eq64(now, clock->timers.data[0]->expire)) { + ret = *min_heap_peek(&clock->timers); + min_heap_pop(&clock->timers, &callbacks, NULL); + } - if (clock->timers.used && - time_after_eq64(now, clock->timers.data[0]->expire)) - heap_pop(&clock->timers, ret, io_timer_cmp, NULL); - spin_unlock(&clock->timer_lock); - return ret; } @@@ -143,18 -177,17 +169,18 @@@ void __bch2_increment_clock(struct io_c void bch2_io_timers_to_text(struct printbuf *out, struct io_clock *clock) { - unsigned long now; - unsigned i; - out->atomic++; spin_lock(&clock->timer_lock); - now = atomic64_read(&clock->now); + u64 now = atomic64_read(&clock->now); + + printbuf_tabstop_push(out, 40); + prt_printf(out, "current time:\t%llu\n", now); - for (unsigned i = 0; i < clock->timers.used; i++) - for (i = 0; i < clock->timers.nr; i++) - prt_printf(out, "%ps:\t%li\n", ++ for (unsigned i = 0; i < clock->timers.nr; i++) + prt_printf(out, "%ps %ps:\t%llu\n", clock->timers.data[i]->fn, - clock->timers.data[i]->expire - now); + clock->timers.data[i]->fn2, + clock->timers.data[i]->expire); spin_unlock(&clock->timer_lock); --out->atomic; } diff --cc include/linux/cacheinfo.h index 3dde175f41088,286db104e0540..108060612bb87 --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h @@@ -3,8 -3,7 +3,8 @@@ #define _LINUX_CACHEINFO_H #include +#include - #include + #include #include struct device_node; diff --cc include/linux/cpu.h index a8926d0a28cdf,ea6ac8f98e4a4..bdcec17324452 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@@ -16,9 -16,7 +16,8 @@@ #include #include - #include #include +#include #include struct device; diff --cc include/linux/interrupt.h index 3a36e64119c8c,136a55455529e..bea39a0292eb4 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@@ -5,8 -5,6 +5,7 @@@ #include #include +#include - #include #include #include #include