Re: 2 futex questions

From: Ingo Molnar (mingo@elte.hu)
Date: Wed Sep 25 2002 - 03:23:16 EST


On Tue, 24 Sep 2002 alfred@leakybucket.org wrote:

> 1) There's a comment in sys_futex(...) that says pos_in_page must not be
> on a page boundary. Could someone explain why?

what it wants to say: 'the futex word must not overflow into the next
page', ie. the futex word needs to be on a single page.

> 2) How is this ever true:
> pos_in_page + sizeof(int) > PAGE_SIZE
> when checking if pos_in_page is valid?

the full test is this:

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

        if ((pos_in_page % __alignof__(int)) != 0
            || pos_in_page + sizeof(int) > PAGE_SIZE)
                return -EINVAL;

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).

        Ingo

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



This archive was generated by hypermail 2b29 : Mon Sep 30 2002 - 22:00:22 EST