[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241224104217.441-1-hdanton@sina.com>
Date: Tue, 24 Dec 2024 18:41:41 +0800
From: Hillf Danton <hdanton@...a.com>
To: imran.f.khan@...cle.com
Cc: Thomas Gleixner <tglx@...utronix.de>,
Tejun Heo <tj@...nel.org>,
john.stultz@...aro.org,
sboyd@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: Query about timer wheel API
On Tue, 24 Dec 2024 01:20:48 +1100 imran.f.khan@...cle.com
>
> static int param_set_queue_work_on_cpu(const char *val, const struct kernel_param *kp)
> {
> int cpu, this_cpu, i;
> struct delayed_work *dwork = NULL;
>
> if (!mutex_trylock(&mutex))
> return -EBUSY;
>
> cpu = simple_strtoul(val, NULL, 0);
> /*if (!cpu_present(cpu))
> return -EINVAL;*/
>
> for (i = 0; i < NUM_WORK_ITEMS; i++) {
> dwork = kzalloc(sizeof(struct delayed_work), GFP_KERNEL);
> if(dwork) {
> this_cpu = get_cpu();
See if checking cpu works for you.
if (cpu >= nr_cpu_ids || !cpu_online(cpu)) {
put_cpu();
pr_err("%s cpu%d invalid\n", __func__, cpu);
break;
}
> INIT_DELAYED_WORK(dwork, delayed_work_func);
> queue_delayed_work_on(cpu, system_wq, dwork, msecs_to_jiffies(10000));
> pr_err("Submitted dwork 0x%px on %s cpu#%d \n", dwork, cpu_online(cpu)?"online":"offline", cpu);
> put_cpu();
> }
>
> }
> mutex_unlock(&mutex);
> return 0;
> }
Powered by blists - more mailing lists