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 return NULL; 588 } 589 590 static void 591 __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack) 592 { ··· 605 struct debug_obj *obj; 606 unsigned long flags; 607 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(); 614 615 db = get_bucket((unsigned long) addr); 616 ··· 689 690 if (!debug_objects_enabled) 691 return 0; 692 693 db = get_bucket((unsigned long) addr); 694 ··· 900 901 if (!debug_objects_enabled) 902 return; 903 904 db = get_bucket((unsigned long) addr); 905
··· 587 return NULL; 588 } 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 + 600 static void 601 __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack) 602 { ··· 595 struct debug_obj *obj; 596 unsigned long flags; 597 598 + debug_objects_fill_pool(); 599 600 db = get_bucket((unsigned long) addr); 601 ··· 684 685 if (!debug_objects_enabled) 686 return 0; 687 + 688 + debug_objects_fill_pool(); 689 690 db = get_bucket((unsigned long) addr); 691 ··· 893 894 if (!debug_objects_enabled) 895 return; 896 + 897 + debug_objects_fill_pool(); 898 899 db = get_bucket((unsigned long) addr); 900