@@ -3154,15 +3154,9 @@ void wakeup_kcompactd(pg_data_t *pgdat, int order, int highest_zoneidx)
3154
3154
static int kcompactd (void * p )
3155
3155
{
3156
3156
pg_data_t * pgdat = (pg_data_t * )p ;
3157
- struct task_struct * tsk = current ;
3158
3157
long default_timeout = msecs_to_jiffies (HPAGE_FRAG_CHECK_INTERVAL_MSEC );
3159
3158
long timeout = default_timeout ;
3160
3159
3161
- const struct cpumask * cpumask = cpumask_of_node (pgdat -> node_id );
3162
-
3163
- if (!cpumask_empty (cpumask ))
3164
- set_cpus_allowed_ptr (tsk , cpumask );
3165
-
3166
3160
set_freezable ();
3167
3161
3168
3162
pgdat -> kcompactd_max_order = 0 ;
@@ -3233,10 +3227,12 @@ void __meminit kcompactd_run(int nid)
3233
3227
if (pgdat -> kcompactd )
3234
3228
return ;
3235
3229
3236
- pgdat -> kcompactd = kthread_run (kcompactd , pgdat , "kcompactd%d" , nid );
3230
+ pgdat -> kcompactd = kthread_create_on_node (kcompactd , pgdat , nid , "kcompactd%d" , nid );
3237
3231
if (IS_ERR (pgdat -> kcompactd )) {
3238
3232
pr_err ("Failed to start kcompactd on node %d\n" , nid );
3239
3233
pgdat -> kcompactd = NULL ;
3234
+ } else {
3235
+ wake_up_process (pgdat -> kcompactd );
3240
3236
}
3241
3237
}
3242
3238
@@ -3254,30 +3250,6 @@ void __meminit kcompactd_stop(int nid)
3254
3250
}
3255
3251
}
3256
3252
3257
- /*
3258
- * It's optimal to keep kcompactd on the same CPUs as their memory, but
3259
- * not required for correctness. So if the last cpu in a node goes
3260
- * away, we get changed to run anywhere: as the first one comes back,
3261
- * restore their cpu bindings.
3262
- */
3263
- static int kcompactd_cpu_online (unsigned int cpu )
3264
- {
3265
- int nid ;
3266
-
3267
- for_each_node_state (nid , N_MEMORY ) {
3268
- pg_data_t * pgdat = NODE_DATA (nid );
3269
- const struct cpumask * mask ;
3270
-
3271
- mask = cpumask_of_node (pgdat -> node_id );
3272
-
3273
- if (cpumask_any_and (cpu_online_mask , mask ) < nr_cpu_ids )
3274
- /* One of our CPUs online: restore mask */
3275
- if (pgdat -> kcompactd )
3276
- set_cpus_allowed_ptr (pgdat -> kcompactd , mask );
3277
- }
3278
- return 0 ;
3279
- }
3280
-
3281
3253
static int proc_dointvec_minmax_warn_RT_change (const struct ctl_table * table ,
3282
3254
int write , void * buffer , size_t * lenp , loff_t * ppos )
3283
3255
{
@@ -3337,15 +3309,6 @@ static struct ctl_table vm_compaction[] = {
3337
3309
static int __init kcompactd_init (void )
3338
3310
{
3339
3311
int nid ;
3340
- int ret ;
3341
-
3342
- ret = cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN ,
3343
- "mm/compaction:online" ,
3344
- kcompactd_cpu_online , NULL );
3345
- if (ret < 0 ) {
3346
- pr_err ("kcompactd: failed to register hotplug callbacks.\n" );
3347
- return ret ;
3348
- }
3349
3312
3350
3313
for_each_node_state (nid , N_MEMORY )
3351
3314
kcompactd_run (nid );
0 commit comments