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


Groups > linux.kernel > #1490369

Re: [PATCH] thread_info: use unsigned long for flags

From Andy Lutomirski <luto@amacapital.net>
Newsgroups linux.kernel
Subject Re: [PATCH] thread_info: use unsigned long for flags
Date 2016-09-23 20:10 +0200
Message-ID <skD58-7dw-25@gated-at.bofh.it> (permalink)
References <skCsp-6Lq-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Sep 23, 2016 at 10:24 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> The generic THREAD_INFO_IN_TASK definition of thread_info::flags is a
> u32, matching x86 prior to the introduction of THREAD_INFO_IN_TASK.
>
> However, common helpers like test_ti_thread_flag() implicitly assume
> that thread_info::flags has at least the size and alignment of unsigned
> long, and relying on padding and alignment provided by other elements of
> task_struct is somewhat fragile. Additionally, some architectures use
> more that 32 bits for thread_info::flags, and others may need to in
> future.
>
> With THREAD_INFO_IN_TASK, task struct follows thread_info with a long
> field, and thus we no longer save any space as we did back in commit
> affa219b60a11b32 ("x86: change thread_info's flag field back to 32
> bits").
>
> Given all this, it makes more sense for the generic thread_info::flags
> to be an unsigned long. Make it so.

I have only one problem with this, and it's a general objection that's
mostly off topic: why the [expletive] do the arch-independent bitfield
helpers think in units of variable size?  It's *absurd*, especially on
big-endian architectures.

Now that that's out of my system, I think this patch is fine.
Big-endian arches that opt in will have to deal with it somehow, but I
don't see why making it 'unsigned long' is worse than anything else.
x86 is fine with this change.

Acked-by: Andy Lutomirski <luto@kernel.org>

Ingo, can you apply this for 4.9 so that we can make this change
before other arches might start depending on the field being u32?

--Andy

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


Thread

[PATCH] thread_info: use unsigned long for flags Mark Rutland <mark.rutland@arm.com> - 2016-09-23 19:30 +0200
  Re: [PATCH] thread_info: use unsigned long for flags Andy Lutomirski <luto@amacapital.net> - 2016-09-23 20:10 +0200
    Re: [PATCH] thread_info: use unsigned long for flags Mark Rutland <mark.rutland@arm.com> - 2016-09-24 01:50 +0200
  [tip:x86/asm] thread_info: Use unsigned long for flags tip-bot for Mark Rutland <tipbot@zytor.com> - 2016-09-24 18:40 +0200

csiph-web