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)

+15 -6
+15 -6
lib/debugobjects.c
··· 587 587 return NULL; 588 588 } 589 589 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 + 590 600 static void 591 601 __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack) 592 602 { ··· 605 595 struct debug_obj *obj; 606 596 unsigned long flags; 607 597 608 - /* 609 - * On RT enabled kernels the pool refill must happen in preemptible 610 - * context: 611 - */ 612 - if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible()) 613 - fill_pool(); 598 + debug_objects_fill_pool(); 614 599 615 600 db = get_bucket((unsigned long) addr); 616 601 ··· 689 684 690 685 if (!debug_objects_enabled) 691 686 return 0; 687 + 688 + debug_objects_fill_pool(); 692 689 693 690 db = get_bucket((unsigned long) addr); 694 691 ··· 900 893 901 894 if (!debug_objects_enabled) 902 895 return; 896 + 897 + debug_objects_fill_pool(); 903 898 904 899 db = get_bucket((unsigned long) addr); 905 900