Skip to content

Commit 21e4543

Browse files
committed
Merge tag 'slab-for-6.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab
Pull slab fix from Vlastimil Babka: - Stable fix for kmem_cache_destroy() called from a WQ_MEM_RECLAIM workqueue causing a warning due to the new kvfree_rcu_barrier() (Uladzislau Rezki) * tag 'slab-for-6.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab: mm/slab/kvfree_rcu: Switch to WQ_MEM_RECLAIM wq
2 parents d4fd25b + dfd3df3 commit 21e4543

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

mm/slab_common.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,8 @@ module_param(rcu_min_cached_objs, int, 0444);
13041304
static int rcu_delay_page_cache_fill_msec = 5000;
13051305
module_param(rcu_delay_page_cache_fill_msec, int, 0444);
13061306

1307+
static struct workqueue_struct *rcu_reclaim_wq;
1308+
13071309
/* Maximum number of jiffies to wait before draining a batch. */
13081310
#define KFREE_DRAIN_JIFFIES (5 * HZ)
13091311
#define KFREE_N_BATCHES 2
@@ -1632,10 +1634,10 @@ __schedule_delayed_monitor_work(struct kfree_rcu_cpu *krcp)
16321634
if (delayed_work_pending(&krcp->monitor_work)) {
16331635
delay_left = krcp->monitor_work.timer.expires - jiffies;
16341636
if (delay < delay_left)
1635-
mod_delayed_work(system_unbound_wq, &krcp->monitor_work, delay);
1637+
mod_delayed_work(rcu_reclaim_wq, &krcp->monitor_work, delay);
16361638
return;
16371639
}
1638-
queue_delayed_work(system_unbound_wq, &krcp->monitor_work, delay);
1640+
queue_delayed_work(rcu_reclaim_wq, &krcp->monitor_work, delay);
16391641
}
16401642

16411643
static void
@@ -1733,7 +1735,7 @@ kvfree_rcu_queue_batch(struct kfree_rcu_cpu *krcp)
17331735
// "free channels", the batch can handle. Break
17341736
// the loop since it is done with this CPU thus
17351737
// queuing an RCU work is _always_ success here.
1736-
queued = queue_rcu_work(system_unbound_wq, &krwp->rcu_work);
1738+
queued = queue_rcu_work(rcu_reclaim_wq, &krwp->rcu_work);
17371739
WARN_ON_ONCE(!queued);
17381740
break;
17391741
}
@@ -1883,7 +1885,7 @@ run_page_cache_worker(struct kfree_rcu_cpu *krcp)
18831885
if (rcu_scheduler_active == RCU_SCHEDULER_RUNNING &&
18841886
!atomic_xchg(&krcp->work_in_progress, 1)) {
18851887
if (atomic_read(&krcp->backoff_page_cache_fill)) {
1886-
queue_delayed_work(system_unbound_wq,
1888+
queue_delayed_work(rcu_reclaim_wq,
18871889
&krcp->page_cache_work,
18881890
msecs_to_jiffies(rcu_delay_page_cache_fill_msec));
18891891
} else {
@@ -2120,6 +2122,10 @@ void __init kvfree_rcu_init(void)
21202122
int i, j;
21212123
struct shrinker *kfree_rcu_shrinker;
21222124

2125+
rcu_reclaim_wq = alloc_workqueue("kvfree_rcu_reclaim",
2126+
WQ_UNBOUND | WQ_MEM_RECLAIM, 0);
2127+
WARN_ON(!rcu_reclaim_wq);
2128+
21232129
/* Clamp it to [0:100] seconds interval. */
21242130
if (rcu_delay_page_cache_fill_msec < 0 ||
21252131
rcu_delay_page_cache_fill_msec > 100 * MSEC_PER_SEC) {

0 commit comments

Comments
 (0)