public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: Ravikiran G Thirumalai <kiran@in.ibm.com>
Cc: linux-kernel@vger.kernel.org,
	lse <lse-tech@lists.sourceforge.net>,
	riel@conectiva.com.br, Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [RFC] Scalable statistics counters using kmalloc_percpu
Date: Fri, 26 Jul 2002 11:46:34 -0700	[thread overview]
Message-ID: <3D41990A.EDC1A530@zip.com.au> (raw)
In-Reply-To: 20020726204033.D18570@in.ibm.com

Ravikiran G Thirumalai wrote:
> 
> Here is a Scalable statistics counter implementation which works on top
> of the kmalloc_percpu dynamic allocator published by Dipankar.
> This patch is against 2.5.27.
> 
> ...
> +static inline int __statctr_init(statctr_t *stctr)
> +{
> +       stctr->ctr = kmalloc_percpu(sizeof(*(stctr->ctr)), GFP_ATOMIC);
> +       if(!stctr->ctr)
> +               return -1;
> +       return 0;
> +}

Minor nit: please force the caller to pass in the gfp_flags when
designing an API like this.  The fact that you were forced to use
GFP_ATOMIC here shows why...

> +       for( i=0; i < NR_CPUS; i++ )
> +               res += *per_cpu_ptr(stctr->ctr, i);
> +       return res;
> +}

Oh dear.  Most people only have two CPUs.

Rusty, can we *please* fix this?  Really soon?


General comment:  we need to clean up the kernel_stat stuff.  We
cannot just make it per-cpu because it is 32k in size already.  I
would suggest that we should break out the disk accounting and
make the rest of kernel_stat per CPU.

That would be a great application of your interface, and a good
way to get your interface merged ;)  Is that something which you
have time to do?

Thanks.

  parent reply	other threads:[~2002-07-26 18:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-26 15:10 [RFC] Scalable statistics counters using kmalloc_percpu Ravikiran G Thirumalai
2002-07-26 15:27 ` Rik van Riel
2002-07-26 15:54   ` [Lse-tech] " Dipankar Sarma
2002-07-29 14:18   ` Ravikiran G Thirumalai
2002-07-26 18:46 ` Andrew Morton [this message]
2002-07-26 19:46   ` William Lee Irwin III
2002-07-26 19:50     ` Robert Love
2002-07-26 19:53       ` William Lee Irwin III
2002-07-26 20:15       ` [Lse-tech] " William Lee Irwin III
2002-07-26 20:22         ` Robert Love
2002-07-27 12:00           ` Zwane Mwaikambo
2002-07-27 12:21         ` Zwane Mwaikambo
2002-07-28 21:33           ` Martin J. Bligh
2002-07-29 10:31             ` Zwane Mwaikambo
2002-07-29 14:54               ` Martin J. Bligh
2002-07-27  1:56   ` Rusty Russell
2002-07-27  4:45     ` Andrew Morton
2002-07-27  4:59       ` Rusty Russell
2002-07-27  6:16         ` Andrew Morton
2002-07-29 10:57   ` Ravikiran G Thirumalai
2002-07-29 18:23     ` Andrew Morton
2002-07-29 18:50       ` [Lse-tech] " Dipankar Sarma
2002-07-30 11:25       ` Ravikiran G Thirumalai

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=3D41990A.EDC1A530@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=kiran@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lse-tech@lists.sourceforge.net \
    --cc=riel@conectiva.com.br \
    --cc=rusty@rustcorp.com.au \
    /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