mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] make schedule_on_each_cpu() look like on_each_cpu()
Date: Thu, 26 Jul 2007 22:27:27 +0400	[thread overview]
Message-ID: <20070726182727.GA173@tv-sign.ru> (raw)
In-Reply-To: <1185448139.8197.78.camel@twins>

On 07/26, Peter Zijlstra wrote:
>
> -int schedule_on_each_cpu(work_func_t func)
> +int schedule_on_each_cpu(void (*func)(void *info), void *info, int retry, int wait)
>  {
>  	int cpu;
> -	struct work_struct *works;
> +	struct schedule_on_each_cpu_work **works;
> +	int err = 0;
>  
> -	works = alloc_percpu(struct work_struct);
> +	works = kzalloc(sizeof(void *)*nr_cpu_ids, GFP_KERNEL);

Not a comment, but a question: why do we need nr_cpu_ids at all?
num_possible_cpus() looks more "correct" if cpu_possible_map has
holes (not sure this can happen in practice).

Another off-topic question: shouldn't we kill the unused "retry"
parameter of on_each_cpu() instead of mirroring it here?

> +out:
> +	for_each_possible_cpu(cpu) {
> +		if (works[cpu])
> +			kfree(works[cpu]);
> +	}

Small nit, kfree(NULL) is OK.

Oleg.


  reply	other threads:[~2007-07-26 18:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-26 11:08 Peter Zijlstra
2007-07-26 18:27 ` Oleg Nesterov [this message]
2007-07-26 18:30   ` Oleg Nesterov
2007-07-26 18:41   ` Peter Zijlstra

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=20070726182727.GA173@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    /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

Powered by JetHome