Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

power: supply: replace use of system_wq with system_percpu_wq

Currently if a user enqueue a work item using schedule_delayed_work() the
used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use
WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to
schedule_work() that is using system_wq and queue_work(), that makes use
again of WORK_CPU_UNBOUND.

This lack of consistentcy cannot be addressed without refactoring the API.

system_unbound_wq should be the default workqueue so as not to enforce
locality constraints for random work whenever it's not required.

Adding system_dfl_wq to encourage its use when unbound work should be used.

queue_work() / queue_delayed_work() / mod_delayed_work() will now use the
new unbound wq: whether the user still use the old wq a warn will be
printed along with a wq redirect to the new one.

The old system_unbound_wq will be kept for a few release cycles.

Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
Link: https://lore.kernel.org/r/20250905090641.106297-2-marco.crivellari@suse.com
[rebased patch to cover recent changes]
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

authored by

Marco Crivellari and committed by
Sebastian Reichel
c4a7748b 7d715345

+12 -12
+3 -3
drivers/power/supply/adc-battery-helper.c
··· 181 181 help->intern_res_avg_mohm /= win_size; 182 182 183 183 out: 184 - queue_delayed_work(system_wq, &help->work, 184 + queue_delayed_work(system_percpu_wq, &help->work, 185 185 (help->poll_count <= INIT_POLL_COUNT) ? 186 186 INIT_POLL_TIME : POLL_TIME); 187 187 ··· 251 251 struct adc_battery_helper *help = power_supply_get_drvdata(psy); 252 252 253 253 dev_dbg(help->psy->dev.parent, "external power changed\n"); 254 - mod_delayed_work(system_wq, &help->work, SETTLE_TIME); 254 + mod_delayed_work(system_percpu_wq, &help->work, SETTLE_TIME); 255 255 } 256 256 EXPORT_SYMBOL_GPL(adc_battery_helper_external_power_changed); 257 257 ··· 260 260 help->poll_count = 0; 261 261 help->ocv_avg_index = 0; 262 262 263 - queue_delayed_work(system_wq, &help->work, 0); 263 + queue_delayed_work(system_percpu_wq, &help->work, 0); 264 264 flush_delayed_work(&help->work); 265 265 } 266 266
+1 -1
drivers/power/supply/bq2415x_charger.c
··· 842 842 if (bq->automode < 1) 843 843 return NOTIFY_OK; 844 844 845 - mod_delayed_work(system_wq, &bq->work, 0); 845 + mod_delayed_work(system_percpu_wq, &bq->work, 0); 846 846 847 847 return NOTIFY_OK; 848 848 }
+1 -1
drivers/power/supply/bq24190_charger.c
··· 1467 1467 * too low default 500mA iinlim. Delay setting the input-current-limit 1468 1468 * for 300ms to avoid this. 1469 1469 */ 1470 - queue_delayed_work(system_wq, &bdi->input_current_limit_work, 1470 + queue_delayed_work(system_percpu_wq, &bdi->input_current_limit_work, 1471 1471 msecs_to_jiffies(300)); 1472 1472 } 1473 1473
+3 -3
drivers/power/supply/bq27xxx_battery.c
··· 1127 1127 1128 1128 mutex_lock(&bq27xxx_list_lock); 1129 1129 list_for_each_entry(di, &bq27xxx_battery_devices, list) 1130 - mod_delayed_work(system_wq, &di->work, 0); 1130 + mod_delayed_work(system_percpu_wq, &di->work, 0); 1131 1131 mutex_unlock(&bq27xxx_list_lock); 1132 1132 1133 1133 return ret; ··· 1945 1945 di->last_update = jiffies; 1946 1946 1947 1947 if (!di->removed && poll_interval > 0) 1948 - mod_delayed_work(system_wq, &di->work, poll_interval * HZ); 1948 + mod_delayed_work(system_percpu_wq, &di->work, poll_interval * HZ); 1949 1949 } 1950 1950 1951 1951 void bq27xxx_battery_update(struct bq27xxx_device_info *di) ··· 2221 2221 struct bq27xxx_device_info *di = power_supply_get_drvdata(psy); 2222 2222 2223 2223 /* After charger plug in/out wait 0.5s for things to stabilize */ 2224 - mod_delayed_work(system_wq, &di->work, HZ / 2); 2224 + mod_delayed_work(system_percpu_wq, &di->work, HZ / 2); 2225 2225 } 2226 2226 2227 2227 int bq27xxx_battery_setup(struct bq27xxx_device_info *di)
+3 -3
drivers/power/supply/rk817_charger.c
··· 1046 1046 rk817_read_props(charger); 1047 1047 1048 1048 /* Run every 8 seconds like the BSP driver did. */ 1049 - queue_delayed_work(system_wq, &charger->work, msecs_to_jiffies(8000)); 1049 + queue_delayed_work(system_percpu_wq, &charger->work, msecs_to_jiffies(8000)); 1050 1050 } 1051 1051 1052 1052 static void rk817_cleanup_node(void *data) ··· 1206 1206 return ret; 1207 1207 1208 1208 /* Force the first update immediately. */ 1209 - mod_delayed_work(system_wq, &charger->work, 0); 1209 + mod_delayed_work(system_percpu_wq, &charger->work, 0); 1210 1210 1211 1211 return 0; 1212 1212 } ··· 1226 1226 struct rk817_charger *charger = dev_get_drvdata(dev); 1227 1227 1228 1228 /* force an immediate update */ 1229 - mod_delayed_work(system_wq, &charger->work, 0); 1229 + mod_delayed_work(system_percpu_wq, &charger->work, 0); 1230 1230 1231 1231 return 0; 1232 1232 }
+1 -1
drivers/power/supply/ucs1002_power.c
··· 493 493 { 494 494 struct ucs1002_info *info = data; 495 495 496 - mod_delayed_work(system_wq, &info->health_poll, 0); 496 + mod_delayed_work(system_percpu_wq, &info->health_poll, 0); 497 497 498 498 return IRQ_HANDLED; 499 499 }