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)
Unified · Split
| @@ -587,6 +587,16 @@ static struct debug_obj *lookup_object_or_alloc(void *addr, struct debug_bucket · 586 unmodified lines | |||
| 587 | return NULL; | 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 | static void | 600 | static void |
| 591 | __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack) | 601 | __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack) |
| 592 | { | 602 | { |
| @@ -595,12 +605,7 @@ __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack · 2 unmodified lines | |||
| 595 | struct debug_obj *obj; | 605 | struct debug_obj *obj; |
| 596 | unsigned long flags; | 606 | unsigned long flags; |
| 597 | 607 | ||
| 598 | /* | 608 | debug_objects_fill_pool(); |
| 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(); | ||
| 604 | 609 | ||
| 605 | db = get_bucket((unsigned long) addr); | 610 | db = get_bucket((unsigned long) addr); |
| 606 | 611 | ||
| @@ -685,6 +690,8 @@ int debug_object_activate(void *addr, const struct debug_obj_descr *descr) · 78 unmodified lines | |||
| 685 | if (!debug_objects_enabled) | 690 | if (!debug_objects_enabled) |
| 686 | return 0; | 691 | return 0; |
| 687 | 692 | ||
| 693 | debug_objects_fill_pool(); | ||
| 694 | |||
| 688 | db = get_bucket((unsigned long) addr); | 695 | db = get_bucket((unsigned long) addr); |
| 689 | 696 | ||
| 690 | raw_spin_lock_irqsave(&db->lock, flags); | 697 | raw_spin_lock_irqsave(&db->lock, flags); |
| @@ -894,6 +901,8 @@ void debug_object_assert_init(void *addr, const struct debug_obj_descr *descr) · 203 unmodified lines | |||
| 894 | if (!debug_objects_enabled) | 901 | if (!debug_objects_enabled) |
| 895 | return; | 902 | return; |
| 896 | 903 | ||
| 904 | debug_objects_fill_pool(); | ||
| 905 | |||
| 897 | db = get_bucket((unsigned long) addr); | 906 | db = get_bucket((unsigned long) addr); |
| 898 | 907 | ||
| 899 | raw_spin_lock_irqsave(&db->lock, flags); | 908 | raw_spin_lock_irqsave(&db->lock, flags); |