linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ingo Molnar <mingo@elte.hu>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	akpm@linux-foundation.org, hpa@zytor.com, brgerst@gmail.com,
	ebiederm@xmission.com, cl@linux-foundation.org, travis@sgi.com,
	linux-kernel@vger.kernel.org, steiner@sgi.com, hugh@veritas.com,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org,
	Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Subject: Re: [PATCH] percpu: add optimized generic percpu accessors
Date: Wed, 28 Jan 2009 19:56:34 +0900	[thread overview]
Message-ID: <498039E2.7090107@kernel.org> (raw)
In-Reply-To: <200901282108.51864.rusty@rustcorp.com.au>

Hello,

Rusty Russell wrote:
> On Tuesday 27 January 2009 12:54:27 Tejun Heo wrote:
>> Hello, Rusty.
> 
> Hi Tejun!
> 
>> There actually were quite some places where atomic add ops would be
>> useful, especially the places where statistics are collected.  For
>> logical bitops, I don't think we'll have too many of them.
> 
> If the stats are only manipulated in one context, than an atomic
> requirement is overkill (and expensive on non-x86).

Yes, it is.  I was hoping it to be not more expensive on most archs.
It isn't on x86 at the very least but I don't know much about other
archs.

>>> If they are worth doing generically, should the ops be atomic? To
>>> extrapolate from x86 usages again, it seems to be happy with
>>> non-atomic (tho of course it is atomic on x86).
>> If atomic rw/add/sub are implementible on most archs (and judging from
>> local_t, I suppose it is), I think it should.  So that it can replace
>> local_t and we won't need something else again in the future.
> 
> This is more like Christoph's CPU_OPS: they were special operators
> on normal per-cpu vars/ptrs.  Generic version was
> irqsave+op+irqrestore.
>
> I actually like this idea, but Mathieu insists that the ops be
> NMI-safe, for ftrace.  Hence local_t needing to be atomic_t for
> generic code.
> 
> AFAICT we'll need a hybrid: HAVE_NMISAFE_CPUOPS, and if not, use
> atomic_t in ftrace (which isn't NMI safe on parisc or sparc/32
> anyway, but I don't think we care).

Requiring NMI-safeness is quite an exception, I suppose.  I don't
think we should design around it.  If it can be worked around one way
or the other, it should be fine.

> Other than the shouting, I liked Christoph's system:
> - CPU_INC = always safe (eg. local_irq_save/per_cpu(i)++/local_irq_restore)
> - _CPU_INC = not safe against interrupts (eg. get_cpu/per_cpu(i)++/put_cpu)
> - __CPU_INC = not safe against anything (eg. per_cpu(i)++)
> 
> I prefer the name 'local' to the name 'cpu', but I'm not hugely fussed.

I like local better too but no biggies one way or the other.

>>>> Another question to ask is whether to keep using separate
>>>> interfaces for static and dynamic percpu variables or migrate to
>>>> something which can take both.
>>> Well, IA64 can do stuff with static percpus that it can't do with
>>> dynamic (assuming we get expanding dynamic percpu areas
>>> later). That's because they use TLB tricks for a static 64k per-cpu
>>> area, but this doesn't scale.  That might not be vital: abandoning
>>> that trick will mean they can't optimise read_percpu/read_percpu_var
>>> etc as much.
>> Isn't something like the following possible?
>>
>> #define pcpu_read(ptr)						\
>> ({								\
>> 	if (__builtin_constant_p(ptr) &&			\
>> 	    ptr >= PCPU_STATIC_START && ptr < PCPU_STATIC_END)	\
>> 		do 64k TLB trick for static pcpu;		\
>> 	else							\
>> 		do generic stuff;				\
>> })
> 
> No, that will be "do generic stuff", since it's a link-time
> constant.  I don't know that this is a huge worry, to be honest.  We
> can leave the __ia64_per_cpu_var for their arch-specific code (I
> feel the same way about x86 to be honest).

Yes, right.  Got confused there.  Hmmm... looks like what would work
there is "is it a lvalue?" test.  Well, anyways, if it isn't
necessary.

>>> Tejun, any chance of you updating the tj-percpu tree? My current
>>> patches are against Linus's tree, and rebasing them on yours
>>> involves some icky merging.
>> If Ingo is okay with it, I'm fine with it too.  Unless Ingo objects,
>> I'll do it tomorrow-ish (still big holiday here).
> 
> Ah, I did not realize that you celebrated Australia day :)

Hey, didn't know Australia was founded on lunar New Year's day.
Nice. :-)

Thanks.

-- 
tejun

  reply	other threads:[~2009-01-28 10:57 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-13 10:38 [PATCHSET linux-2.6-x86:tip] x86: make percpu offsets zero-based on SMP Tejun Heo
2009-01-13 10:38 ` [PATCH 01/13] x86_64: fix pda_to_op() Tejun Heo
2009-01-13 10:38 ` [PATCH 02/13] x86: make early_per_cpu() a lvalue and use it Tejun Heo
2009-01-13 11:43   ` [PATCH 02/13 UPDATED] " Tejun Heo
2009-01-13 10:38 ` [PATCH 03/13] x86_64: Cleanup early setup_percpu references Tejun Heo
2009-01-13 10:38 ` [PATCH 04/13] x86_32: make vmlinux_32.lds.S use PERCPU() macro Tejun Heo
2009-01-13 10:38 ` [PATCH 05/13] x86_64: make percpu symbols zerobased on SMP Tejun Heo
2009-01-13 10:38 ` [PATCH 06/13] x86_64: load pointer to pda into %gs while brining up a CPU Tejun Heo
2009-01-13 10:38 ` [PATCH 07/13] x86_64: use static _cpu_pda array Tejun Heo
2009-01-13 10:38 ` [PATCH 08/13] x86_64: fold pda into percpu area on SMP Tejun Heo
2009-01-13 10:38 ` [PATCH 09/13] x86_64: merge 64 and 32 SMP percpu handling Tejun Heo
2009-01-13 10:38 ` [PATCH 10/13] x86_64: make pda a percpu variable Tejun Heo
2009-01-13 10:38 ` [PATCH 11/13] x86_64: convert pda ops to wrappers around x86 percpu accessors Tejun Heo
2009-01-13 10:38 ` [PATCH 12/13] x86_64: misc clean up after the percpu update Tejun Heo
2009-01-13 10:38 ` [PATCH 13/13] x86_32: make percpu symbols zerobased on SMP Tejun Heo
2009-01-14  0:18   ` Rusty Russell
2009-01-14  2:03     ` Tejun Heo
2009-01-13 10:48 ` [PATCHSET linux-2.6-x86:tip] x86: make percpu offsets zero-based " Tejun Heo
2009-01-13 13:27   ` Brian Gerst
2009-01-13 14:05     ` Tejun Heo
2009-01-13 14:26       ` Brian Gerst
2009-01-13 14:37         ` Tejun Heo
2009-01-14  6:57       ` H. Peter Anvin
2009-01-14  9:38         ` [patch] add optimized generic percpu accessors Ingo Molnar
2009-01-14  9:45           ` Ingo Molnar
     [not found]           ` <200901151253.44016.rusty@rustcorp.com.au>
2009-01-15  9:55             ` Ingo Molnar
2009-01-15 10:27             ` Tejun Heo
2009-01-15 10:04           ` roel kluin
2009-01-15 10:26             ` Tejun Heo
2009-01-15 11:32               ` Ingo Molnar
2009-01-15 11:36                 ` Tejun Heo
2009-01-15 12:22                   ` Ingo Molnar
2009-01-15 13:09                     ` Tejun Heo
2009-01-15 13:32                       ` Ingo Molnar
2009-01-15 13:33                         ` Ingo Molnar
2009-01-15 13:39                         ` Ingo Molnar
2009-01-15 21:54                           ` Tejun Heo
2009-01-16  1:28                             ` [PATCH x86/percpu] x86: fix build bug introduced during merge Tejun Heo
2009-01-16  3:25                               ` [PATCH x86/percpu] x86_64: initialize this_cpu_off to __per_cpu_load Tejun Heo
2009-01-16 13:16                                 ` Ingo Molnar
2009-01-16 13:47                                   ` Tejun Heo
     [not found]                                     ` <20090116221651.GA32736@elte.hu>
     [not found]                                       ` <20090116223828.GA9294@elte.hu>
     [not found]                                         ` <49716F0E.7060605@gmail.com>
     [not found]                                           ` <49716FBF.7080203@kernel.org>
2009-01-17  6:29                                             ` [PATCH core/percpu REPOST] linker script: add missing VMLINUX_SYMBOL Tejun Heo
2009-01-17  6:32                                               ` [PATCH] linker script: add missing .data.percpu.page_aligned Tejun Heo
2009-01-17  8:21                                                 ` Ingo Molnar
2009-01-21 23:46                                                 ` Christoph Lameter
2009-01-21 23:45                                               ` [PATCH core/percpu REPOST] linker script: add missing VMLINUX_SYMBOL Christoph Lameter
2009-01-15 22:34                           ` [patch] add optimized generic percpu accessors Ingo Molnar
2009-01-15 20:31                     ` Christoph Lameter
2009-01-16  9:41                       ` Tejun Heo
2009-01-16 13:23                         ` Ingo Molnar
2009-01-16 13:49                           ` Tejun Heo
2009-01-15 10:26           ` Tejun Heo
2009-01-15 11:30             ` Ingo Molnar
2009-01-15 11:38               ` Tejun Heo
2009-01-15 12:26                 ` Ingo Molnar
2009-01-15 13:04                   ` Tejun Heo
2009-01-15 13:07                     ` Ingo Molnar
2009-01-15 13:23                       ` [PATCH] percpu: " Tejun Heo
2009-01-15 13:36                         ` Ingo Molnar
2009-01-15 17:30                         ` Andrew Morton
2009-01-15 18:02                           ` Ingo Molnar
2009-01-15 18:34                             ` Andrew Morton
2009-01-15 18:39                               ` Ingo Molnar
2009-01-15 21:53                                 ` Tejun Heo
2009-01-16  0:12                                 ` Herbert Xu
2009-01-16  0:15                                   ` Ingo Molnar
2009-01-16  0:18                                     ` Herbert Xu
     [not found]                                       ` <200901170827.33729.rusty@rustcorp.com.au>
2009-01-16 22:08                                         ` Ingo Molnar
     [not found]                                           ` <200901201328.24605.rusty@rustcorp.com.au>
2009-01-20  6:25                                             ` Tejun Heo
2009-01-20 10:36                                               ` Ingo Molnar
     [not found]                                               ` <200901271213.18605.rusty@rustcorp.com.au>
2009-01-27  2:24                                                 ` Tejun Heo
2009-01-27 13:13                                                   ` Ingo Molnar
2009-01-27 23:07                                                     ` Tejun Heo
2009-01-28  3:36                                                       ` Tejun Heo
2009-01-28  8:12                                                         ` Tejun Heo
2009-01-27 20:08                                                   ` Christoph Lameter
2009-01-27 21:47                                                     ` David Miller
2009-01-27 22:47                                                       ` Rick Jones
2009-01-28  0:17                                                         ` Luck, Tony
2009-01-28 16:48                                                           ` Christoph Lameter
2009-01-28 17:15                                                             ` Luck, Tony
2009-01-28 16:45                                                       ` Christoph Lameter
2009-01-28 20:47                                                         ` David Miller
2009-01-28 10:38                                                   ` Rusty Russell
2009-01-28 10:56                                                     ` Tejun Heo [this message]
2009-01-29  2:06                                                       ` Rusty Russell
2009-01-31  6:11                                                         ` Tejun Heo
2009-01-28 16:50                                                     ` Christoph Lameter
2009-01-28 18:07                                                       ` Mathieu Desnoyers
2009-01-29 18:33                                                         ` Christoph Lameter
2009-01-29 18:48                                                           ` H. Peter Anvin
2009-01-20 10:40                                             ` Ingo Molnar
2009-01-21  5:52                                               ` Tejun Heo
2009-01-21 10:05                                                 ` Ingo Molnar
2009-01-21 11:21                                                 ` Eric W. Biederman
2009-01-21 12:45                                                   ` Stephen Hemminger
2009-01-21 14:13                                                     ` Eric W. Biederman
2009-01-21 20:34                                                     ` David Miller
2009-01-16  1:09                                     ` H. Peter Anvin
     [not found]                                   ` <200901170804.18622.rusty@rustcorp.com.au>
2009-01-16 21:59                                     ` Ingo Molnar
2009-01-16 22:09                                     ` Ingo Molnar
2009-01-16 14:10                               ` Mark Lord
2009-01-15 18:46                         ` Ingo Molnar
2009-01-31 10:36                         ` Jeremy Fitzhardinge
2009-01-15 13:59                     ` [patch] " roel kluin
2009-01-15 21:51                       ` Tejun Heo
     [not found]                 ` <200901170748.53734.rusty@rustcorp.com.au>
2009-01-16 21:24                   ` Ingo Molnar
2009-01-31 10:30           ` Jeremy Fitzhardinge
2009-01-31 16:00             ` Ingo Molnar

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=498039E2.7090107@kernel.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=brgerst@gmail.com \
    --cc=cl@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=hpa@zytor.com \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=steiner@sgi.com \
    --cc=travis@sgi.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;
as well as URLs for NNTP newsgroup(s).