Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Rusty Russell
On Mon, 30 Jan 2012 10:16:39 -0800, Tejun Heo t...@kernel.org wrote: On Mon, Jan 30, 2012 at 12:12:18PM -0600, Christoph Lameter wrote: I thought it didn't. I rememer thinking about this and determining that NULL can't be allocated for dynamic addresses. Maybe I'm imagining things.

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Tejun Heo
On Mon, Jan 30, 2012 at 11:22:57AM -0600, Christoph Lameter wrote: On Mon, 30 Jan 2012, Tejun Heo wrote: On Mon, Jan 30, 2012 at 09:15:58AM -0800, Tejun Heo wrote: Percpu pointers are in a different address space and using ZERO_SIZE_PTR directly will trigger sparse address space

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Tejun Heo
On Mon, Jan 30, 2012 at 10:02:24AM -0800, Tejun Heo wrote: I thought it didn't. I rememer thinking about this and determining that NULL can't be allocated for dynamic addresses. Maybe I'm imagining things. Anyways, if it can return NULL for valid allocation, it is a bug and should be fixed.

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Christoph Lameter
On Mon, 30 Jan 2012, Tejun Heo wrote: I'm pretty sure it never gives out NULL for a dynamic allocation. The base might be mapped to zero but we're guaranteed to have some static percpu areas there and IIRC the percpu addresses aren't supposed to wrap. True but there is a check for a NULL

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Tejun Heo
On Mon, Jan 30, 2012 at 09:15:58AM -0800, Tejun Heo wrote: Percpu pointers are in a different address space and using ZERO_SIZE_PTR directly will trigger sparse address space warning. Also, I'm not entirely sure whether 16 is guaranteed to be unused in percpu address space (maybe it is but I

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Christoph Lameter
On Mon, 30 Jan 2012, Tejun Heo wrote: Hello, Christoph. On Mon, Jan 30, 2012 at 11:52:23AM -0600, Christoph Lameter wrote: We have two possibilities now: 1. We say that the value returned from the per cpu allocator is an opaque value. This means that we have to remove the NULL

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Christoph Lameter
On Mon, 30 Jan 2012, Tejun Heo wrote: Hello, On Mon, Jan 30, 2012 at 11:58:52AM -0600, Christoph Lameter wrote: No, NULL is never gonna be a valid return from any allocator including percpu. Percpu allocator doesn't and will never do so. How do you prevent the percpu allocator from

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Christoph Lameter
On Mon, 30 Jan 2012, Tejun Heo wrote: On Mon, Jan 30, 2012 at 09:15:58AM -0800, Tejun Heo wrote: Percpu pointers are in a different address space and using ZERO_SIZE_PTR directly will trigger sparse address space warning. Also, I'm not entirely sure whether 16 is guaranteed to be unused in

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Christoph Lameter
On Mon, 30 Jan 2012, Tejun Heo wrote: Percpu pointers are in a different address space and using ZERO_SIZE_PTR directly will trigger sparse address space warning. Also, I'm not entirely sure whether 16 is guaranteed to be unused in percpu address space (maybe it is but I don't think we have

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Tejun Heo
On Mon, Jan 30, 2012 at 12:37:34PM +0400, Dmitry Antipov wrote: Fix pcpu_alloc() to return ZERO_SIZE_PTR if requested size is 0; fix free_percpu() to check passed pointer with ZERO_OR_NULL_PTR. Signed-off-by: Dmitry Antipov dmitry.anti...@linaro.org --- mm/percpu.c | 16 +++-

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Tejun Heo
Hello, Christoph. On Mon, Jan 30, 2012 at 11:52:23AM -0600, Christoph Lameter wrote: We have two possibilities now: 1. We say that the value returned from the per cpu allocator is an opaque value. This means that we have to remove the NULL check from the free function. And

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Christoph Lameter
On Mon, 30 Jan 2012, Tejun Heo wrote: Anyways, yeah, it seems we should improve this part too. I agree. ___ linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Tejun Heo
Hello, On Mon, Jan 30, 2012 at 11:58:52AM -0600, Christoph Lameter wrote: No, NULL is never gonna be a valid return from any allocator including percpu. Percpu allocator doesn't and will never do so. How do you prevent the percpu allocator from returning NULL? I thought the per cpu

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Christoph Lameter
On Mon, 30 Jan 2012, Tejun Heo wrote: On Mon, Jan 30, 2012 at 11:22:14AM -0600, Christoph Lameter wrote: On Mon, 30 Jan 2012, Tejun Heo wrote: Percpu pointers are in a different address space and using ZERO_SIZE_PTR directly will trigger sparse address space warning. Also, I'm not

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Tejun Heo
On Mon, Jan 30, 2012 at 11:22:14AM -0600, Christoph Lameter wrote: On Mon, 30 Jan 2012, Tejun Heo wrote: Percpu pointers are in a different address space and using ZERO_SIZE_PTR directly will trigger sparse address space warning. Also, I'm not entirely sure whether 16 is guaranteed to be

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-31 Thread Tejun Heo
On Mon, Jan 30, 2012 at 12:12:18PM -0600, Christoph Lameter wrote: I thought it didn't. I rememer thinking about this and determining that NULL can't be allocated for dynamic addresses. Maybe I'm imagining things. Anyways, if it can return NULL for valid allocation, it is a bug and

[PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-30 Thread Dmitry Antipov
Fix pcpu_alloc() to return ZERO_SIZE_PTR if requested size is 0; fix free_percpu() to check passed pointer with ZERO_OR_NULL_PTR. Signed-off-by: Dmitry Antipov dmitry.anti...@linaro.org --- mm/percpu.c | 16 +++- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git

Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

2012-01-30 Thread Christoph Lameter
On Mon, 30 Jan 2012, Dmitry Antipov wrote: Fix pcpu_alloc() to return ZERO_SIZE_PTR if requested size is 0; fix free_percpu() to check passed pointer with ZERO_OR_NULL_PTR. Acked-by: Christoph Lameter c...@linux.com ___ linaro-dev mailing list