Skip to content

Commit 17784de

Browse files
committed
Merge tag 'core-debugobjects-2023-05-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull debugobjects fix from Thomas Gleixner: "A single fix for debugobjects: The recent fix to ensure atomicity of lookup and allocation inadvertently broke the pool refill mechanism, so that debugobject OOMs now in certain situations. The reason is that the functions which got updated no longer invoke debug_objecs_init(), which is now the only place to care about refilling the tracking object pool. Restore the original behaviour by adding explicit refill opportunities to those places" * tag 'core-debugobjects-2023-05-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: debugobject: Ensure pool refill (again)
2 parents 6f69c98 + 0af462f commit 17784de

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

lib/debugobjects.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,16 @@ static struct debug_obj *lookup_object_or_alloc(void *addr, struct debug_bucket
587587
return NULL;
588588
}
589589

590+
static void debug_objects_fill_pool(void)
591+
{
592+
/*
593+
* On RT enabled kernels the pool refill must happen in preemptible
594+
* context:
595+
*/
596+
if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible())
597+
fill_pool();
598+
}
599+
590600
static void
591601
__debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack)
592602
{
@@ -595,12 +605,7 @@ __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack
595605
struct debug_obj *obj;
596606
unsigned long flags;
597607

598-
/*
599-
* On RT enabled kernels the pool refill must happen in preemptible
600-
* context:
601-
*/
602-
if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible())
603-
fill_pool();
608+
debug_objects_fill_pool();
604609

605610
db = get_bucket((unsigned long) addr);
606611

@@ -685,6 +690,8 @@ int debug_object_activate(void *addr, const struct debug_obj_descr *descr)
685690
if (!debug_objects_enabled)
686691
return 0;
687692

693+
debug_objects_fill_pool();
694+
688695
db = get_bucket((unsigned long) addr);
689696

690697
raw_spin_lock_irqsave(&db->lock, flags);
@@ -894,6 +901,8 @@ void debug_object_assert_init(void *addr, const struct debug_obj_descr *descr)
894901
if (!debug_objects_enabled)
895902
return;
896903

904+
debug_objects_fill_pool();
905+
897906
db = get_bucket((unsigned long) addr);
898907

899908
raw_spin_lock_irqsave(&db->lock, flags);

0 commit comments

Comments
 (0)