From: Rusty Russell <rusty@au1.ibm.com>
To: dipankar@in.ibm.com
Cc: Paul McKenney <paul.mckenney@us.ibm.com>, linux-kernel@vger.kernel.org
Subject: Re: [patch] RCU for low latency [2/2]
Date: Fri, 09 Jan 2004 10:43:34 +1100 [thread overview]
Message-ID: <20040109000244.8C58D17DDE@ozlabs.au.ibm.com> (raw)
In-Reply-To: Your message of "Thu, 08 Jan 2004 17:20:51 +0530." <20040108115051.GC5128@in.ibm.com>
In message <20040108115051.GC5128@in.ibm.com> you write:
> @@ -54,6 +54,11 @@ DEFINE_PER_CPU(struct rcu_data, rcu_data
> /* Fake initialization required by compiler */
> static DEFINE_PER_CPU(struct tasklet_struct, rcu_tasklet) = {NULL};
> #define RCU_tasklet(cpu) (per_cpu(rcu_tasklet, cpu))
> +#ifdef CONFIG_PREEMPT
> +static int rcu_max_bh_callbacks = 256;
> +#else
> +static int rcu_max_bh_callbacks = 0;
> +#endif
>
> +static inline int rcu_limiting_needed(int cpu)
> +{
> + if (in_softirq() && RCU_krcud(cpu))
> + return 1;
> + return 0;
> +}
> +
> /*
> * Invoke the completed RCU callbacks. They are expected to be in
> * a per-cpu list.
> @@ -87,13 +99,24 @@ static void rcu_do_batch(struct list_hea
> {
> struct list_head *entry;
> struct rcu_head *head;
> + int count = 0;
> + int cpu = smp_processor_id();
> + int limit = rcu_limiting_needed(cpu);
>
> while (!list_empty(list)) {
> entry = list->next;
> list_del(entry);
> head = list_entry(entry, struct rcu_head, list);
> head->func(head->arg);
> + count++;
> + if (limit && count > rcu_max_bh_callbacks &&
> + rq_has_rt_task(cpu)) {
Perhaps you should do this the other way:
static inline unsigned int max_rcu_at_once(int cpu)
{
if (in_softirq() && RCU_krcud(cpu) && rq_has_rt_task(cpu))
return rcu_max_bh_callbacks;
return (unsigned int)-1;
}
....
unsigned int count, limit = max_rcu_at_once(cpu);
...
if (++count > limit)
Ideally you'd create a new workqueue for this, or at the very least
use kthread primitives (once they're in -mm, hopefully soon).
> +static int start_krcud(int cpu)
> +{
> + if (rcu_max_bh_callbacks) {
> + if (kernel_thread(krcud, (void *)(long)cpu, CLONE_KERNEL) < 0) {
> + printk("krcud for %i failed\n", cpu);
> + return -1;
EPERM seems unusual here. How about:
int pid;
pid = kernel_thread(krcud, (void *)(long)cpu, CLONE_KERNEL);
if (pid < 0) {
printk(printk("krcud for %i failed\n", cpu);
return pid;
}
> +__setup("rcubhlimit=", rcu_bh_limit_setup);
Please use module_param(). If it's a good name for a variable, it's a
good name for a parameter. eg. just call the variable bhlimit, and
then the boot parameter will be called "rcu.bhlimit" which fits the
calling conventio we're trying to encourage.
Cheers,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
next prev parent reply other threads:[~2004-01-09 0:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-08 11:48 [patch] RCU for low latency [0/1] Dipankar Sarma
2004-01-08 11:49 ` [patch] RCU for low latency [1/2] Dipankar Sarma
2004-01-08 11:50 ` [patch] RCU for low latency [2/2] Dipankar Sarma
2004-01-08 23:43 ` Rusty Russell [this message]
2004-01-14 8:24 ` Dipankar Sarma
2004-01-14 23:35 ` Rusty Russell
2004-01-15 6:03 ` Dipankar Sarma
2004-01-19 23:25 ` Rusty Russell
2004-01-20 1:22 ` Lincoln Dale
2004-01-08 15:12 ` [patch] RCU for low latency [1/2] Nick Piggin
2004-01-08 19:33 ` Dipankar Sarma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040109000244.8C58D17DDE@ozlabs.au.ibm.com \
--to=rusty@au1.ibm.com \
--cc=dipankar@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paul.mckenney@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®