Re: 2 futex questions

Ingo Molnar (mingo@elte.hu)
Wed, 25 Sep 2002 10:23:16 +0200 (CEST)


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/