[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zl8bhs0s.fsf@blp.benpfaff.org>
Date: Thu, 01 Oct 2009 11:45:55 -0700
From: Ben Pfaff <blp@...stanford.edu>
To: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 10/19] workqueue: update cwq alignement and make one more flag bit available
David Howells <dhowells@...hat.com> writes:
> Tejun Heo <tj@...nel.org> wrote:
>
>> +enum {
>> + WORK_STRUCT_PENDING = 0, /* work item is pending execution */
>> +
>> + /*
>> + * Reserve 3bits off of cwq pointer. This is enough and
>> + * provides acceptable alignment on both 32 and 64bit
>> + * machines.
>> + */
>> + WORK_STRUCT_FLAG_BITS = 3,
>> +
>> + WORK_STRUCT_FLAG_MASK = (1UL << WORK_STRUCT_FLAG_BITS) - 1,
>> + WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK,
>> +};
>
> There's some great enum abuse going on here:-)
The "1UL" part is a bit worrisome. Enumeration constants always
have type "int"[*], so if code that uses WORK_STRUCT_WQ_DATA_MASK
actually depends on getting a full "long" worth of bits, it is
not going to work on 64-bit systems.
[*] See C99:
6.4.4.3 Enumeration constants
Syntax
1 enumeration-constant:
identifier
Semantics
2 An identifier declared as an enumeration constant has type int.
--
Ben Pfaff
http://benpfaff.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists