Re: Add prefetch switch stack hook in scheduler function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  include/asm-alpha/mmu_context.h     |    6 ++++++
>  include/asm-arm/mmu_context.h       |    6 ++++++
>  include/asm-arm26/mmu_context.h     |    6 ++++++
>  include/asm-cris/mmu_context.h      |    6 ++++++
>  include/asm-frv/mmu_context.h       |    6 ++++++
>  include/asm-h8300/mmu_context.h     |    6 ++++++
>  include/asm-i386/mmu_context.h      |    6 ++++++
>  include/asm-ia64/mmu_context.h      |    6 ++++++
>  include/asm-m32r/mmu_context.h      |    6 ++++++
>  include/asm-m68k/mmu_context.h      |    6 ++++++
>  include/asm-m68knommu/mmu_context.h |    6 ++++++
>  include/asm-mips/mmu_context.h      |    6 ++++++
>  include/asm-parisc/mmu_context.h    |    6 ++++++
>  include/asm-ppc/mmu_context.h       |    6 ++++++
>  include/asm-ppc64/mmu_context.h     |    6 ++++++
>  include/asm-s390/mmu_context.h      |    6 ++++++
>  include/asm-sh/mmu_context.h        |    6 ++++++
>  include/asm-sh64/mmu_context.h      |    6 ++++++
>  include/asm-sparc/mmu_context.h     |    6 ++++++
>  include/asm-sparc64/mmu_context.h   |    6 ++++++
>  include/asm-um/mmu_context.h        |    6 ++++++
>  include/asm-v850/mmu_context.h      |    6 ++++++
>  include/asm-x86_64/mmu_context.h    |    5 +++++
>  include/asm-xtensa/mmu_context.h    |    6 ++++++
>  kernel/sched.c                      |    9 ++++++++-
>  25 files changed, 151 insertions(+), 1 deletion(-)

I think this pretty clearly points out the need for some arch-generic
infrastructure in Linux.  An awful lot of arch hooks are for one
or two architectures with some peculiarities, and the other 90% of
the implementations are identical.

For example, this is 22 repetitions of
#define MIN_KERNEL_STACK_FOOTPRINT L1_CACHE_BYTES

with one different case.

It would be awfully nice if there was a standard way to provide a default
implementation that was automatically picked up by any architecture that
didn't explicitly override it.

One possibility is to use #ifndef:

/* asm-$PLATFORM/foo.h */
#define MIN_KERNEL_STACK_FOOTPRINT IA64_SWITCH_STACK_SIZE
inline void
prefetch_task(struct task_struct const *task)
{
	...
}
#define prefetch_task prefetch_task


/* asm-generic/foo.h */
#include <asm/foo.h>

#ifndef MIN_KERNEL_STACK_FOOTPRINT
#define MIN_KERNEL_STACK_FOOTPRINT L1_CACHE_BYTES
#endif

#ifndef prefetch_task
inline void prefetch_task(struct task_struct const *task) { }
/* The #define is OPTIONAL... */
#define prefetch_task prefetch_task
#endif


But both understanding and maintaining the arch code could be
much easier if the shared parts were collapsed.  A comment in the
generic versions can explain what the assumptions are.


If there are cases where there is more than one implementation with
multiple users, it can be stuffed into a third category of headers.
E.g. <asm-generic/noiommu/foo.h> and <asm-generic/iommu/foo.h> or some
such, using the same duplicate-suppression technique and #included at
the end of <asm-$PLATFORM/foo.h>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux