All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Ingo Molnar <mingo@elte.hu>
Cc: Keith Owens <kaos@ocs.com.au>,
	David.Mosberger@acm.org, Andrew Morton <akpm@osdl.org>,
	"Chen, Kenneth W" <kenneth.w.chen@intel.com>,
	linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org
Subject: Re: Add prefetch switch stack hook in scheduler function
Date: Thu, 28 Jul 2005 09:34:00 +0000	[thread overview]
Message-ID: <42E8A688.7070802@yahoo.com.au> (raw)
In-Reply-To: <20050728091638.GA25846@elte.hu>

Ingo Molnar wrote:
> * Nick Piggin <nickpiggin@yahoo.com.au> wrote:
> 
> 

>>>such as?
>>
>>Not sure. thread_info? Maybe next->timestamp or some other fields in 
>>next, something in next->mm?
> 
> 
> next->thread_info we could and should prefetch - but from the generic 
> scheduler code (see the patch i just sent).
> 

Right. We're always testing the TIF_NEED_RESCHED field after the
switch.

> i'm not sure what you mean by prefetching next->timestamp, it's an 
> inline field to 'next', in the first cacheline of it, which we've 
> already used so it's present. (If you mean the value of next->timestamp, 
> that has no address meaning at all so would lead to unpredictable 
> results on some arches.)
> 

No, I meant the cacheline holding the field of course. I guess I
could have looked for a field further down, but even so, ->timestamp
might be 96 bytes into the structure on a 64-bit arch, which may or
may not be the first cacheline... but you get the idea.

> next->mm we might want to prefetch, but it's probably not worth it 
> because we are referencing it too soon, in context_switch(). (while the 
> kernel stack itself wont be referenced until the full context-switch is 
> done) But might be worth trying - but even then, it should be done from 
> the generic code, like the thread_info and kernel-stack prefetching.
> 
> 
>>I didn't really have a concrete example, but in the interests of being 
>>future proof...
> 
> 
> i'd like to keep generic bits in generic code, and only move things to 
> per-arch include files if absolutely necessary. next->mm is generic.
> 

Yeah, then a specific field _within_ next->mm or thread_info may
want to be fetched. In short, I don't see any argument why we
shouldn't call the function prefetch_task().

Secondly, I don't really like your prefetch(kernel_stack()) function
because it doesn't really give architectures enough control over
exactly what cachelines they get in memory.

prefetching and memory access patterns of all this stuff are fairly
architecture specific. I see nothing wrong with having a prefetch_task()
call. (Although I agree things like thread_info->flags and next->mm can
be done in generic code).

Nick

-- 
SUSE Labs, Novell Inc.

Send instant messages to your online friends http://au.messenger.yahoo.com 

WARNING: multiple messages have this Message-ID (diff)
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Ingo Molnar <mingo@elte.hu>
Cc: Keith Owens <kaos@ocs.com.au>,
	David.Mosberger@acm.org, Andrew Morton <akpm@osdl.org>,
	"Chen, Kenneth W" <kenneth.w.chen@intel.com>,
	linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org
Subject: Re: Add prefetch switch stack hook in scheduler function
Date: Thu, 28 Jul 2005 19:34:00 +1000	[thread overview]
Message-ID: <42E8A688.7070802@yahoo.com.au> (raw)
In-Reply-To: <20050728091638.GA25846@elte.hu>

Ingo Molnar wrote:
> * Nick Piggin <nickpiggin@yahoo.com.au> wrote:
> 
> 

>>>such as?
>>
>>Not sure. thread_info? Maybe next->timestamp or some other fields in 
>>next, something in next->mm?
> 
> 
> next->thread_info we could and should prefetch - but from the generic 
> scheduler code (see the patch i just sent).
> 

Right. We're always testing the TIF_NEED_RESCHED field after the
switch.

> i'm not sure what you mean by prefetching next->timestamp, it's an 
> inline field to 'next', in the first cacheline of it, which we've 
> already used so it's present. (If you mean the value of next->timestamp, 
> that has no address meaning at all so would lead to unpredictable 
> results on some arches.)
> 

No, I meant the cacheline holding the field of course. I guess I
could have looked for a field further down, but even so, ->timestamp
might be 96 bytes into the structure on a 64-bit arch, which may or
may not be the first cacheline... but you get the idea.

> next->mm we might want to prefetch, but it's probably not worth it 
> because we are referencing it too soon, in context_switch(). (while the 
> kernel stack itself wont be referenced until the full context-switch is 
> done) But might be worth trying - but even then, it should be done from 
> the generic code, like the thread_info and kernel-stack prefetching.
> 
> 
>>I didn't really have a concrete example, but in the interests of being 
>>future proof...
> 
> 
> i'd like to keep generic bits in generic code, and only move things to 
> per-arch include files if absolutely necessary. next->mm is generic.
> 

Yeah, then a specific field _within_ next->mm or thread_info may
want to be fetched. In short, I don't see any argument why we
shouldn't call the function prefetch_task().

Secondly, I don't really like your prefetch(kernel_stack()) function
because it doesn't really give architectures enough control over
exactly what cachelines they get in memory.

prefetching and memory access patterns of all this stuff are fairly
architecture specific. I see nothing wrong with having a prefetch_task()
call. (Although I agree things like thread_info->flags and next->mm can
be done in generic code).

Nick

-- 
SUSE Labs, Novell Inc.

Send instant messages to your online friends http://au.messenger.yahoo.com 

  parent reply	other threads:[~2005-07-28  9:34 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-27 22:07 Add prefetch switch stack hook in scheduler function Chen, Kenneth W
2005-07-27 22:07 ` Chen, Kenneth W
2005-07-27 23:13 ` Andrew Morton
2005-07-27 23:13   ` Andrew Morton
2005-07-27 23:23   ` david mosberger
2005-07-27 23:23     ` david mosberger
2005-07-28  7:41     ` Ingo Molnar
2005-07-28  7:41       ` Ingo Molnar
2005-07-28  8:09 ` Keith Owens
2005-07-28  8:09   ` Keith Owens
2005-07-28  8:16   ` Ingo Molnar
2005-07-28  8:16     ` Ingo Molnar
2005-07-28  9:09     ` Ingo Molnar
2005-07-28  9:09       ` Ingo Molnar
2005-07-28  8:31   ` Nick Piggin
2005-07-28  8:31     ` Nick Piggin
2005-07-28  8:35     ` Ingo Molnar
2005-07-28  8:35       ` Ingo Molnar
2005-07-28  8:48       ` Nick Piggin
2005-07-28  8:48         ` Nick Piggin
2005-07-28  9:16         ` Ingo Molnar
2005-07-28  9:16           ` Ingo Molnar
2005-07-28  9:19           ` Ingo Molnar
2005-07-28  9:19             ` Ingo Molnar
2005-07-28  9:34           ` Nick Piggin [this message]
2005-07-28  9:34             ` Nick Piggin
2005-07-28 10:04             ` Ingo Molnar
2005-07-28 10:04               ` Ingo Molnar
2005-07-28 10:29               ` Nick Piggin
2005-07-28 10:29                 ` Nick Piggin
2005-07-28 19:14 ` Chen, Kenneth W
2005-07-28 19:14   ` Chen, Kenneth W
2005-07-29  7:04   ` Ingo Molnar
2005-07-29  7:04     ` Ingo Molnar
2005-07-29  7:07     ` Ingo Molnar
2005-07-29  7:07       ` Ingo Molnar
2005-07-29  8:30       ` Eric Dumazet
2005-07-29  8:30         ` Eric Dumazet
2005-07-29  8:44         ` Ingo Molnar
2005-07-29  8:44           ` Ingo Molnar
2005-07-31 16:27         ` hashed spinlocks Daniel Walker
2005-07-31 18:46           ` David S. Miller
2005-07-31 19:06             ` Daniel Walker
2005-07-31 19:11               ` David S. Miller
2005-07-31 19:16                 ` Daniel Walker
2005-07-29  9:17       ` Add prefetch switch stack hook in scheduler function Peter Zijlstra
2005-07-29  9:17         ` Peter Zijlstra
2005-07-29 10:52         ` Ingo Molnar
2005-07-29 10:52           ` Ingo Molnar
2005-07-29  7:22 ` Chen, Kenneth W
2005-07-29  7:22   ` Chen, Kenneth W
2005-07-29  8:28   ` Ingo Molnar
2005-07-29  8:28     ` Ingo Molnar
2005-07-29  9:02     ` Russell King
2005-07-29  9:02       ` Russell King
2005-07-29  9:45       ` Ingo Molnar
2005-07-29  9:45         ` Ingo Molnar
2005-07-29  7:38 ` Keith Owens
2005-07-29  7:38   ` Keith Owens
2005-07-29  7:45 ` Keith Owens
2005-07-29  7:45   ` Keith Owens
2005-07-29  8:02 ` Chen, Kenneth W
2005-07-29  8:02   ` Chen, Kenneth W
2005-07-29  8:08 ` Chen, Kenneth W
2005-07-29  8:08   ` Chen, Kenneth W
2005-07-29  8:30 ` Chen, Kenneth W
2005-07-29  8:30   ` Chen, Kenneth W
2005-07-29  8:35   ` Ingo Molnar
2005-07-29  8:35     ` Ingo Molnar
2005-07-29  8:39 ` Chen, Kenneth W
2005-07-29  8:39   ` Chen, Kenneth W
  -- strict thread matches above, loose matches on Subject: below --
2005-07-29 15:18 linux
2005-07-29 15:49 ` 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=42E8A688.7070802@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=David.Mosberger@acm.org \
    --cc=akpm@osdl.org \
    --cc=kaos@ocs.com.au \
    --cc=kenneth.w.chen@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.