Skip to content

Commit 527eff2

Browse files
committed
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() ...
2 parents fbc90c0 + 67856f4 commit 527eff2

File tree

156 files changed

+1416
-842
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+1416
-842
lines changed

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3801,8 +3801,10 @@ F: include/linux/bitmap-str.h
38013801
F: include/linux/bitmap.h
38023802
F: include/linux/bits.h
38033803
F: include/linux/cpumask.h
3804+
F: include/linux/cpumask_types.h
38043805
F: include/linux/find.h
38053806
F: include/linux/nodemask.h
3807+
F: include/linux/nodemask_types.h
38063808
F: include/vdso/bits.h
38073809
F: lib/bitmap-str.c
38083810
F: lib/bitmap.c

arch/powerpc/kernel/vmlinux.lds.S

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ SECTIONS
123123
*/
124124
*(.sfpr);
125125
*(.text.asan.* .text.tsan.*)
126-
MEM_KEEP(init.text)
127-
MEM_KEEP(exit.text)
128126
} :text
129127

130128
. = ALIGN(PAGE_SIZE);

drivers/fsi/fsi-occ.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -656,17 +656,16 @@ static int occ_probe(struct platform_device *pdev)
656656
rc = of_property_read_u32(dev->of_node, "reg", &reg);
657657
if (!rc) {
658658
/* make sure we don't have a duplicate from dts */
659-
occ->idx = ida_simple_get(&occ_ida, reg, reg + 1,
660-
GFP_KERNEL);
659+
occ->idx = ida_alloc_range(&occ_ida, reg, reg,
660+
GFP_KERNEL);
661661
if (occ->idx < 0)
662-
occ->idx = ida_simple_get(&occ_ida, 1, INT_MAX,
663-
GFP_KERNEL);
662+
occ->idx = ida_alloc_min(&occ_ida, 1,
663+
GFP_KERNEL);
664664
} else {
665-
occ->idx = ida_simple_get(&occ_ida, 1, INT_MAX,
666-
GFP_KERNEL);
665+
occ->idx = ida_alloc_min(&occ_ida, 1, GFP_KERNEL);
667666
}
668667
} else {
669-
occ->idx = ida_simple_get(&occ_ida, 1, INT_MAX, GFP_KERNEL);
668+
occ->idx = ida_alloc_min(&occ_ida, 1, GFP_KERNEL);
670669
}
671670

672671
platform_set_drvdata(pdev, occ);
@@ -680,7 +679,7 @@ static int occ_probe(struct platform_device *pdev)
680679
rc = misc_register(&occ->mdev);
681680
if (rc) {
682681
dev_err(dev, "failed to register miscdevice: %d\n", rc);
683-
ida_simple_remove(&occ_ida, occ->idx);
682+
ida_free(&occ_ida, occ->idx);
684683
kvfree(occ->buffer);
685684
return rc;
686685
}
@@ -719,7 +718,7 @@ static int occ_remove(struct platform_device *pdev)
719718
else
720719
device_for_each_child(&pdev->dev, NULL, occ_unregister_of_child);
721720

722-
ida_simple_remove(&occ_ida, occ->idx);
721+
ida_free(&occ_ida, occ->idx);
723722

724723
return 0;
725724
}

drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static int eb_create(struct i915_execbuffer *eb)
340340
* Without a 1:1 association between relocation handles and
341341
* the execobject[] index, we instead create a hashtable.
342342
* We size it dynamically based on available memory, starting
343-
* first with 1:1 assocative hash and scaling back until
343+
* first with 1:1 associative hash and scaling back until
344344
* the allocation succeeds.
345345
*
346346
* Later on we use a positive lut_size to indicate we are

drivers/md/bcache/alloc.c

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -164,40 +164,68 @@ static void bch_invalidate_one_bucket(struct cache *ca, struct bucket *b)
164164
* prio is worth 1/8th of what INITIAL_PRIO is worth.
165165
*/
166166

167-
#define bucket_prio(b) \
168-
({ \
169-
unsigned int min_prio = (INITIAL_PRIO - ca->set->min_prio) / 8; \
170-
\
171-
(b->prio - ca->set->min_prio + min_prio) * GC_SECTORS_USED(b); \
172-
})
167+
static inline unsigned int new_bucket_prio(struct cache *ca, struct bucket *b)
168+
{
169+
unsigned int min_prio = (INITIAL_PRIO - ca->set->min_prio) / 8;
170+
171+
return (b->prio - ca->set->min_prio + min_prio) * GC_SECTORS_USED(b);
172+
}
173+
174+
static inline bool new_bucket_max_cmp(const void *l, const void *r, void *args)
175+
{
176+
struct bucket **lhs = (struct bucket **)l;
177+
struct bucket **rhs = (struct bucket **)r;
178+
struct cache *ca = args;
179+
180+
return new_bucket_prio(ca, *lhs) > new_bucket_prio(ca, *rhs);
181+
}
173182

174-
#define bucket_max_cmp(l, r) (bucket_prio(l) < bucket_prio(r))
175-
#define bucket_min_cmp(l, r) (bucket_prio(l) > bucket_prio(r))
183+
static inline bool new_bucket_min_cmp(const void *l, const void *r, void *args)
184+
{
185+
struct bucket **lhs = (struct bucket **)l;
186+
struct bucket **rhs = (struct bucket **)r;
187+
struct cache *ca = args;
188+
189+
return new_bucket_prio(ca, *lhs) < new_bucket_prio(ca, *rhs);
190+
}
191+
192+
static inline void new_bucket_swap(void *l, void *r, void __always_unused *args)
193+
{
194+
struct bucket **lhs = l, **rhs = r;
195+
196+
swap(*lhs, *rhs);
197+
}
176198

177199
static void invalidate_buckets_lru(struct cache *ca)
178200
{
179201
struct bucket *b;
180-
ssize_t i;
202+
const struct min_heap_callbacks bucket_max_cmp_callback = {
203+
.less = new_bucket_max_cmp,
204+
.swp = new_bucket_swap,
205+
};
206+
const struct min_heap_callbacks bucket_min_cmp_callback = {
207+
.less = new_bucket_min_cmp,
208+
.swp = new_bucket_swap,
209+
};
181210

182-
ca->heap.used = 0;
211+
ca->heap.nr = 0;
183212

184213
for_each_bucket(b, ca) {
185214
if (!bch_can_invalidate_bucket(ca, b))
186215
continue;
187216

188-
if (!heap_full(&ca->heap))
189-
heap_add(&ca->heap, b, bucket_max_cmp);
190-
else if (bucket_max_cmp(b, heap_peek(&ca->heap))) {
217+
if (!min_heap_full(&ca->heap))
218+
min_heap_push(&ca->heap, &b, &bucket_max_cmp_callback, ca);
219+
else if (!new_bucket_max_cmp(&b, min_heap_peek(&ca->heap), ca)) {
191220
ca->heap.data[0] = b;
192-
heap_sift(&ca->heap, 0, bucket_max_cmp);
221+
min_heap_sift_down(&ca->heap, 0, &bucket_max_cmp_callback, ca);
193222
}
194223
}
195224

196-
for (i = ca->heap.used / 2 - 1; i >= 0; --i)
197-
heap_sift(&ca->heap, i, bucket_min_cmp);
225+
min_heapify_all(&ca->heap, &bucket_min_cmp_callback, ca);
198226

199227
while (!fifo_full(&ca->free_inc)) {
200-
if (!heap_pop(&ca->heap, b, bucket_min_cmp)) {
228+
if (!ca->heap.nr) {
201229
/*
202230
* We don't want to be calling invalidate_buckets()
203231
* multiple times when it can't do anything
@@ -206,6 +234,8 @@ static void invalidate_buckets_lru(struct cache *ca)
206234
wake_up_gc(ca->set);
207235
return;
208236
}
237+
b = min_heap_peek(&ca->heap)[0];
238+
min_heap_pop(&ca->heap, &bucket_min_cmp_callback, ca);
209239

210240
bch_invalidate_one_bucket(ca, b);
211241
}

drivers/md/bcache/bcache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ struct cache {
458458
/* Allocation stuff: */
459459
struct bucket *buckets;
460460

461-
DECLARE_HEAP(struct bucket *, heap);
461+
DEFINE_MIN_HEAP(struct bucket *, cache_heap) heap;
462462

463463
/*
464464
* If nonzero, we know we aren't going to find any buckets to invalidate

0 commit comments

Comments
 (0)