Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1186271

Re: [RFC][PATCH] x86, fpu: dynamically allocate 'struct fpu'

From Dave Hansen <dave@sr71.net>
Newsgroups linux.kernel
Subject Re: [RFC][PATCH] x86, fpu: dynamically allocate 'struct fpu'
Date 2015-07-16 23:30 +0200
Message-ID <pMYT8-1RA-25@gated-at.bofh.it> (permalink)
References <pMWRk-7rm-29@gated-at.bofh.it> <pMX10-7CX-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 07/16/2015 12:25 PM, Andy Lutomirski wrote:
> On Thu, Jul 16, 2015 at 12:14 PM, Dave Hansen <dave@sr71.net> wrote:
>> +#define CHECK_MEMBER_AT_END_OF(TYPE, MEMBER)   \
>> +       BUILD_BUG_ON((sizeof(TYPE) -                    \
>> +                       offsetof(TYPE, MEMBER) -        \
>> +                       sizeof(((TYPE *)0)->MEMBER)) >  \
>> +                       0)                              \
>> +
> 
> You could save a bit of typing by using offsetofend here.  Something
> along the lines of BUILD_BUG_ON(sizeof(TYPE) != offsetofend(TYPE,
> MEMBER));

Good point.

>>  #endif /* _ASM_X86_FPU_H */
>> diff -puN arch/x86/kernel/process.c~dynamically-allocate-struct-fpu arch/x86/kernel/process.c
>> --- a/arch/x86/kernel/process.c~dynamically-allocate-struct-fpu 2015-07-16 10:50:42.360571875 -0700
>> +++ b/arch/x86/kernel/process.c 2015-07-16 12:00:59.204808551 -0700
>> @@ -81,7 +81,7 @@ EXPORT_SYMBOL_GPL(idle_notifier_unregist
>>   */
>>  int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
>>  {
>> -       *dst = *src;
>> +       memcpy(dst, src, arch_task_struct_size());
> 
> This is actually vaguely performance-critical, which makes me thing
> that using some kind of inline or other real way (config macro, ifdef,
> etc) to detect whether there's an arch override would be better than a
> weak function.

Fair enough.  I'll send out another version in a bit if there are no
more comments.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC][PATCH] x86, fpu: dynamically allocate 'struct fpu' Dave Hansen <dave@sr71.net> - 2015-07-16 21:20 +0200
  Re: [RFC][PATCH] x86, fpu: dynamically allocate 'struct fpu' Andy Lutomirski <luto@amacapital.net> - 2015-07-16 21:30 +0200
    Re: [RFC][PATCH] x86, fpu: dynamically allocate 'struct fpu' Dave Hansen <dave@sr71.net> - 2015-07-16 23:30 +0200
      Re: [RFC][PATCH] x86, fpu: dynamically allocate 'struct fpu' Ingo Molnar <mingo@kernel.org> - 2015-07-17 10:50 +0200
        [PATCH] x86/fpu, sched: Introduce  CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT and use it on x86 Ingo Molnar <mingo@kernel.org> - 2015-07-17 11:40 +0200
  Re: [RFC][PATCH] x86, fpu: dynamically allocate 'struct fpu' Peter Zijlstra <peterz@infradead.org> - 2015-07-17 00:40 +0200
    [PATCH] x86/fpu, bug.h: Move CHECK_MEMBER_AT_END_OF() to a generic  header and use it in generic code Ingo Molnar <mingo@kernel.org> - 2015-07-17 10:50 +0200
    Re: [RFC][PATCH] x86, fpu: dynamically allocate 'struct fpu' Ingo Molnar <mingo@kernel.org> - 2015-07-17 10:50 +0200
  Re: [RFC][PATCH] x86, fpu: dynamically allocate 'struct fpu' "H. Peter Anvin" <hpa@zytor.com> - 2015-07-17 00:50 +0200
    Re: [RFC][PATCH] x86, fpu: dynamically allocate 'struct fpu' Andy Lutomirski <luto@amacapital.net> - 2015-07-17 01:00 +0200
  Re: [RFC][PATCH] x86, fpu: dynamically allocate 'struct fpu' Ingo Molnar <mingo@kernel.org> - 2015-07-17 10:30 +0200

csiph-web