[patch] Re: 2 futex questions

alfred@leakybucket.org
Tue, 24 Sep 2002 18:14:01 -0700


On Wed, Sep 25, 2002 at 10:23:16AM +0200, Ingo Molnar wrote:
>
> what it says: 'uaddr must be naturally aligned, and the word must be on a
> single page'. In theory it's possible that __alignof__(int) !=
> sizeof(int).
>

Ok, would the following actually save some cycles then?

diff -u a/kernel/futex.c b/kernel/futex.c
--- a/kernel/futex.c Tue Sep 24 15:25:01 2002
+++ b/kernel/futex.c Tue Sep 24 18:09:09 2002
@@ -321,9 +321,10 @@

pos_in_page = ((unsigned long)uaddr) % PAGE_SIZE;

- /* Must be "naturally" aligned, and not on page boundary. */
+ /* Must be "naturally" aligned, and must not cross a page boundary. */
if ((pos_in_page % __alignof__(int)) != 0
- || pos_in_page + sizeof(int) > PAGE_SIZE)
+ || ((sizeof(int) != __alignof__(int))
+ && (pos_in_page + sizeof(int) > PAGE_SIZE)))
return -EINVAL;

/* Simpler if it doesn't vanish underneath us. */

Alfred Landrum
-
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/