Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-28 Thread Yinghai Lu
On Fri, Dec 28, 2012 at 6:42 AM, JoonSoo Kim  wrote:
>
> I have a different idea.
> How about removing fallback allocation in bootmem.c completely?
> I don't know why it is there exactly.
> But, warning for 'slab_is_available()' is there for a long time.
> So, most people who misuse fallback allocation change their code adequately.
> I think that removing fallback at this time is valid. Isn't it?

if you guys really want to make thing simple, please do try to help to kill
mm/bootmem.c and use memblock instead.

at last we could the wrapper mm/nobootmem.c.

Thanks

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-28 Thread JoonSoo Kim
Hello, Sasha.

2012/12/28 Sasha Levin :
> On 12/27/2012 06:04 PM, David Rientjes wrote:
>> On Thu, 27 Dec 2012, Sasha Levin wrote:
>>
>>> That's exactly what happens with the patch. Note that in the current 
>>> upstream
>>> version there are several slab checks scattered all over.
>>>
>>> In this case for example, I'm removing it from __alloc_bootmem_node(), but 
>>> the
>>> first code line of__alloc_bootmem_node_nopanic() is:
>>>
>>> if (WARN_ON_ONCE(slab_is_available()))
>>> return kzalloc(size, GFP_NOWAIT);
>>>
>>
>> You're only talking about mm/bootmem.c and not mm/nobootmem.c, and notice
>> that __alloc_bootmem_node() does not call __alloc_bootmem_node_nopanic(),
>> it calls ___alloc_bootmem_node_nopanic().
>
> Holy cow, this is an underscore hell.
>
>
> Thanks,
> Sasha
>

I have a different idea.
How about removing fallback allocation in bootmem.c completely?
I don't know why it is there exactly.
But, warning for 'slab_is_available()' is there for a long time.
So, most people who misuse fallback allocation change their code adequately.
I think that removing fallback at this time is valid. Isn't it?

Fallback allocation may cause possible bug.
If someone free a memory from fallback allocation,
it can't be handled properly.

So, IMHO, at this time, we should remove fallback allocation in
bootmem.c entirely.
Please let me know what I misunderstand.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-28 Thread JoonSoo Kim
Hello, Sasha.

2012/12/28 Sasha Levin sasha.le...@oracle.com:
 On 12/27/2012 06:04 PM, David Rientjes wrote:
 On Thu, 27 Dec 2012, Sasha Levin wrote:

 That's exactly what happens with the patch. Note that in the current 
 upstream
 version there are several slab checks scattered all over.

 In this case for example, I'm removing it from __alloc_bootmem_node(), but 
 the
 first code line of__alloc_bootmem_node_nopanic() is:

 if (WARN_ON_ONCE(slab_is_available()))
 return kzalloc(size, GFP_NOWAIT);


 You're only talking about mm/bootmem.c and not mm/nobootmem.c, and notice
 that __alloc_bootmem_node() does not call __alloc_bootmem_node_nopanic(),
 it calls ___alloc_bootmem_node_nopanic().

 Holy cow, this is an underscore hell.


 Thanks,
 Sasha


I have a different idea.
How about removing fallback allocation in bootmem.c completely?
I don't know why it is there exactly.
But, warning for 'slab_is_available()' is there for a long time.
So, most people who misuse fallback allocation change their code adequately.
I think that removing fallback at this time is valid. Isn't it?

Fallback allocation may cause possible bug.
If someone free a memory from fallback allocation,
it can't be handled properly.

So, IMHO, at this time, we should remove fallback allocation in
bootmem.c entirely.
Please let me know what I misunderstand.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-28 Thread Yinghai Lu
On Fri, Dec 28, 2012 at 6:42 AM, JoonSoo Kim js1...@gmail.com wrote:

 I have a different idea.
 How about removing fallback allocation in bootmem.c completely?
 I don't know why it is there exactly.
 But, warning for 'slab_is_available()' is there for a long time.
 So, most people who misuse fallback allocation change their code adequately.
 I think that removing fallback at this time is valid. Isn't it?

if you guys really want to make thing simple, please do try to help to kill
mm/bootmem.c and use memblock instead.

at last we could the wrapper mm/nobootmem.c.

Thanks

Yinghai
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-27 Thread Sasha Levin
On 12/27/2012 06:04 PM, David Rientjes wrote:
> On Thu, 27 Dec 2012, Sasha Levin wrote:
> 
>> That's exactly what happens with the patch. Note that in the current upstream
>> version there are several slab checks scattered all over.
>>
>> In this case for example, I'm removing it from __alloc_bootmem_node(), but 
>> the
>> first code line of__alloc_bootmem_node_nopanic() is:
>>
>> if (WARN_ON_ONCE(slab_is_available()))
>> return kzalloc(size, GFP_NOWAIT);
>>
> 
> You're only talking about mm/bootmem.c and not mm/nobootmem.c, and notice 
> that __alloc_bootmem_node() does not call __alloc_bootmem_node_nopanic(), 
> it calls ___alloc_bootmem_node_nopanic().

Holy cow, this is an underscore hell.


Thanks,
Sasha

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-27 Thread David Rientjes
On Thu, 27 Dec 2012, Sasha Levin wrote:

> That's exactly what happens with the patch. Note that in the current upstream
> version there are several slab checks scattered all over.
> 
> In this case for example, I'm removing it from __alloc_bootmem_node(), but the
> first code line of__alloc_bootmem_node_nopanic() is:
> 
> if (WARN_ON_ONCE(slab_is_available()))
> return kzalloc(size, GFP_NOWAIT);
> 

You're only talking about mm/bootmem.c and not mm/nobootmem.c, and notice 
that __alloc_bootmem_node() does not call __alloc_bootmem_node_nopanic(), 
it calls ___alloc_bootmem_node_nopanic().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-27 Thread Sasha Levin
On 12/27/2012 05:25 PM, David Rientjes wrote:
> On Sun, 23 Dec 2012, Sasha Levin wrote:
> 
>> diff --git a/mm/bootmem.c b/mm/bootmem.c
>> index 1324cd7..198a92f 100644
>> --- a/mm/bootmem.c
>> +++ b/mm/bootmem.c
>> @@ -763,9 +763,6 @@ void * __init ___alloc_bootmem_node(pg_data_t *pgdat, 
>> unsigned long size,
>>  void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
>> unsigned long align, unsigned long goal)
>>  {
>> -if (WARN_ON_ONCE(slab_is_available()))
>> -return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
>> -
>>  return  ___alloc_bootmem_node(pgdat, size, align, goal, 0);
>>  }
>>  
> 
> All you're doing is removing the fallback if this happens to be called 
> with slab_is_available().  It's still possible that the slab allocator can 
> successfully allocate the memory, though.  So it would be rather 
> unfortunate to start panicking in a situation that used to only emit a 
> warning.
> 
> Why can't you panic only kzalloc_node() returns NULL and otherwise just 
> return the allocated memory?

That's exactly what happens with the patch. Note that in the current upstream
version there are several slab checks scattered all over.

In this case for example, I'm removing it from __alloc_bootmem_node(), but the
first code line of__alloc_bootmem_node_nopanic() is:

if (WARN_ON_ONCE(slab_is_available()))
return kzalloc(size, GFP_NOWAIT);

So the current behaviour is still preserved, but the code is simplified to
have only one place that allocates memory (both from the slab and from bootmem),
instead of having slab allocations sprinkled all over.


Thanks,
Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-27 Thread Pekka Enberg
On Fri, Dec 28, 2012 at 12:31 AM, David Rientjes  wrote:
> On Fri, 28 Dec 2012, Pekka Enberg wrote:
>
>> On Sun, 23 Dec 2012, Sasha Levin wrote:
>> >> diff --git a/mm/bootmem.c b/mm/bootmem.c
>> >> index 1324cd7..198a92f 100644
>> >> --- a/mm/bootmem.c
>> >> +++ b/mm/bootmem.c
>> >> @@ -763,9 +763,6 @@ void * __init ___alloc_bootmem_node(pg_data_t *pgdat, 
>> >> unsigned long size,
>> >>  void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
>> >>  unsigned long align, unsigned long goal)
>> >>  {
>> >> - if (WARN_ON_ONCE(slab_is_available()))
>> >> - return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
>> >> -
>> >>   return  ___alloc_bootmem_node(pgdat, size, align, goal, 0);
>> >>  }
>>
>> I'm not sure what Sasha's patch is trying to do here but the fall-back
>> is there simply to let the caller know it's calling the bootmem
>> allocator *too late*. That is, the slab allocator is already up and
>> running so you're expected to use that.
>>
>
> The __alloc_bootmem_node() variant is intended to panic rather than return
> NULL so there are callers that do not check the return value.  I'm
> suggesting rather than removing the fallback to the slab allocator to
> check the return value and panic() here if kzalloc_node() returns NULL.
> The __alloc_bootmem_node_nopanic() variant needs not be changed.

Makes sense. Dropping the fallback completely just makes it more
difficult to find early boot bugs where the bootmem allocator is
called too late.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-27 Thread David Rientjes
On Fri, 28 Dec 2012, Pekka Enberg wrote:

> On Sun, 23 Dec 2012, Sasha Levin wrote:
> >> diff --git a/mm/bootmem.c b/mm/bootmem.c
> >> index 1324cd7..198a92f 100644
> >> --- a/mm/bootmem.c
> >> +++ b/mm/bootmem.c
> >> @@ -763,9 +763,6 @@ void * __init ___alloc_bootmem_node(pg_data_t *pgdat, 
> >> unsigned long size,
> >>  void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
> >>  unsigned long align, unsigned long goal)
> >>  {
> >> - if (WARN_ON_ONCE(slab_is_available()))
> >> - return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
> >> -
> >>   return  ___alloc_bootmem_node(pgdat, size, align, goal, 0);
> >>  }
> 
> I'm not sure what Sasha's patch is trying to do here but the fall-back
> is there simply to let the caller know it's calling the bootmem
> allocator *too late*. That is, the slab allocator is already up and
> running so you're expected to use that.
> 

The __alloc_bootmem_node() variant is intended to panic rather than return 
NULL so there are callers that do not check the return value.  I'm 
suggesting rather than removing the fallback to the slab allocator to 
check the return value and panic() here if kzalloc_node() returns NULL.  
The __alloc_bootmem_node_nopanic() variant needs not be changed.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-27 Thread Pekka Enberg
On Sun, 23 Dec 2012, Sasha Levin wrote:
>> diff --git a/mm/bootmem.c b/mm/bootmem.c
>> index 1324cd7..198a92f 100644
>> --- a/mm/bootmem.c
>> +++ b/mm/bootmem.c
>> @@ -763,9 +763,6 @@ void * __init ___alloc_bootmem_node(pg_data_t *pgdat, 
>> unsigned long size,
>>  void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
>>  unsigned long align, unsigned long goal)
>>  {
>> - if (WARN_ON_ONCE(slab_is_available()))
>> - return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
>> -
>>   return  ___alloc_bootmem_node(pgdat, size, align, goal, 0);
>>  }

On Fri, Dec 28, 2012 at 12:25 AM, David Rientjes  wrote:
> All you're doing is removing the fallback if this happens to be called
> with slab_is_available().  It's still possible that the slab allocator can
> successfully allocate the memory, though.  So it would be rather
> unfortunate to start panicking in a situation that used to only emit a
> warning.
>
> Why can't you panic only kzalloc_node() returns NULL and otherwise just
> return the allocated memory?

I'm not sure what Sasha's patch is trying to do here but the fall-back
is there simply to let the caller know it's calling the bootmem
allocator *too late*. That is, the slab allocator is already up and
running so you're expected to use that.

Pekka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-27 Thread David Rientjes
On Sun, 23 Dec 2012, Sasha Levin wrote:

> diff --git a/mm/bootmem.c b/mm/bootmem.c
> index 1324cd7..198a92f 100644
> --- a/mm/bootmem.c
> +++ b/mm/bootmem.c
> @@ -763,9 +763,6 @@ void * __init ___alloc_bootmem_node(pg_data_t *pgdat, 
> unsigned long size,
>  void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
>  unsigned long align, unsigned long goal)
>  {
> - if (WARN_ON_ONCE(slab_is_available()))
> - return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
> -
>   return  ___alloc_bootmem_node(pgdat, size, align, goal, 0);
>  }
>  

All you're doing is removing the fallback if this happens to be called 
with slab_is_available().  It's still possible that the slab allocator can 
successfully allocate the memory, though.  So it would be rather 
unfortunate to start panicking in a situation that used to only emit a 
warning.

Why can't you panic only kzalloc_node() returns NULL and otherwise just 
return the allocated memory?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-27 Thread David Rientjes
On Sun, 23 Dec 2012, Sasha Levin wrote:

 diff --git a/mm/bootmem.c b/mm/bootmem.c
 index 1324cd7..198a92f 100644
 --- a/mm/bootmem.c
 +++ b/mm/bootmem.c
 @@ -763,9 +763,6 @@ void * __init ___alloc_bootmem_node(pg_data_t *pgdat, 
 unsigned long size,
  void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
  unsigned long align, unsigned long goal)
  {
 - if (WARN_ON_ONCE(slab_is_available()))
 - return kzalloc_node(size, GFP_NOWAIT, pgdat-node_id);
 -
   return  ___alloc_bootmem_node(pgdat, size, align, goal, 0);
  }
  

All you're doing is removing the fallback if this happens to be called 
with slab_is_available().  It's still possible that the slab allocator can 
successfully allocate the memory, though.  So it would be rather 
unfortunate to start panicking in a situation that used to only emit a 
warning.

Why can't you panic only kzalloc_node() returns NULL and otherwise just 
return the allocated memory?
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-27 Thread Pekka Enberg
On Sun, 23 Dec 2012, Sasha Levin wrote:
 diff --git a/mm/bootmem.c b/mm/bootmem.c
 index 1324cd7..198a92f 100644
 --- a/mm/bootmem.c
 +++ b/mm/bootmem.c
 @@ -763,9 +763,6 @@ void * __init ___alloc_bootmem_node(pg_data_t *pgdat, 
 unsigned long size,
  void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
  unsigned long align, unsigned long goal)
  {
 - if (WARN_ON_ONCE(slab_is_available()))
 - return kzalloc_node(size, GFP_NOWAIT, pgdat-node_id);
 -
   return  ___alloc_bootmem_node(pgdat, size, align, goal, 0);
  }

On Fri, Dec 28, 2012 at 12:25 AM, David Rientjes rient...@google.com wrote:
 All you're doing is removing the fallback if this happens to be called
 with slab_is_available().  It's still possible that the slab allocator can
 successfully allocate the memory, though.  So it would be rather
 unfortunate to start panicking in a situation that used to only emit a
 warning.

 Why can't you panic only kzalloc_node() returns NULL and otherwise just
 return the allocated memory?

I'm not sure what Sasha's patch is trying to do here but the fall-back
is there simply to let the caller know it's calling the bootmem
allocator *too late*. That is, the slab allocator is already up and
running so you're expected to use that.

Pekka
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-27 Thread David Rientjes
On Fri, 28 Dec 2012, Pekka Enberg wrote:

 On Sun, 23 Dec 2012, Sasha Levin wrote:
  diff --git a/mm/bootmem.c b/mm/bootmem.c
  index 1324cd7..198a92f 100644
  --- a/mm/bootmem.c
  +++ b/mm/bootmem.c
  @@ -763,9 +763,6 @@ void * __init ___alloc_bootmem_node(pg_data_t *pgdat, 
  unsigned long size,
   void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
   unsigned long align, unsigned long goal)
   {
  - if (WARN_ON_ONCE(slab_is_available()))
  - return kzalloc_node(size, GFP_NOWAIT, pgdat-node_id);
  -
return  ___alloc_bootmem_node(pgdat, size, align, goal, 0);
   }
 
 I'm not sure what Sasha's patch is trying to do here but the fall-back
 is there simply to let the caller know it's calling the bootmem
 allocator *too late*. That is, the slab allocator is already up and
 running so you're expected to use that.
 

The __alloc_bootmem_node() variant is intended to panic rather than return 
NULL so there are callers that do not check the return value.  I'm 
suggesting rather than removing the fallback to the slab allocator to 
check the return value and panic() here if kzalloc_node() returns NULL.  
The __alloc_bootmem_node_nopanic() variant needs not be changed.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-27 Thread Pekka Enberg
On Fri, Dec 28, 2012 at 12:31 AM, David Rientjes rient...@google.com wrote:
 On Fri, 28 Dec 2012, Pekka Enberg wrote:

 On Sun, 23 Dec 2012, Sasha Levin wrote:
  diff --git a/mm/bootmem.c b/mm/bootmem.c
  index 1324cd7..198a92f 100644
  --- a/mm/bootmem.c
  +++ b/mm/bootmem.c
  @@ -763,9 +763,6 @@ void * __init ___alloc_bootmem_node(pg_data_t *pgdat, 
  unsigned long size,
   void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
   unsigned long align, unsigned long goal)
   {
  - if (WARN_ON_ONCE(slab_is_available()))
  - return kzalloc_node(size, GFP_NOWAIT, pgdat-node_id);
  -
return  ___alloc_bootmem_node(pgdat, size, align, goal, 0);
   }

 I'm not sure what Sasha's patch is trying to do here but the fall-back
 is there simply to let the caller know it's calling the bootmem
 allocator *too late*. That is, the slab allocator is already up and
 running so you're expected to use that.


 The __alloc_bootmem_node() variant is intended to panic rather than return
 NULL so there are callers that do not check the return value.  I'm
 suggesting rather than removing the fallback to the slab allocator to
 check the return value and panic() here if kzalloc_node() returns NULL.
 The __alloc_bootmem_node_nopanic() variant needs not be changed.

Makes sense. Dropping the fallback completely just makes it more
difficult to find early boot bugs where the bootmem allocator is
called too late.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-27 Thread Sasha Levin
On 12/27/2012 05:25 PM, David Rientjes wrote:
 On Sun, 23 Dec 2012, Sasha Levin wrote:
 
 diff --git a/mm/bootmem.c b/mm/bootmem.c
 index 1324cd7..198a92f 100644
 --- a/mm/bootmem.c
 +++ b/mm/bootmem.c
 @@ -763,9 +763,6 @@ void * __init ___alloc_bootmem_node(pg_data_t *pgdat, 
 unsigned long size,
  void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
 unsigned long align, unsigned long goal)
  {
 -if (WARN_ON_ONCE(slab_is_available()))
 -return kzalloc_node(size, GFP_NOWAIT, pgdat-node_id);
 -
  return  ___alloc_bootmem_node(pgdat, size, align, goal, 0);
  }
  
 
 All you're doing is removing the fallback if this happens to be called 
 with slab_is_available().  It's still possible that the slab allocator can 
 successfully allocate the memory, though.  So it would be rather 
 unfortunate to start panicking in a situation that used to only emit a 
 warning.
 
 Why can't you panic only kzalloc_node() returns NULL and otherwise just 
 return the allocated memory?

That's exactly what happens with the patch. Note that in the current upstream
version there are several slab checks scattered all over.

In this case for example, I'm removing it from __alloc_bootmem_node(), but the
first code line of__alloc_bootmem_node_nopanic() is:

if (WARN_ON_ONCE(slab_is_available()))
return kzalloc(size, GFP_NOWAIT);

So the current behaviour is still preserved, but the code is simplified to
have only one place that allocates memory (both from the slab and from bootmem),
instead of having slab allocations sprinkled all over.


Thanks,
Sasha
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-27 Thread David Rientjes
On Thu, 27 Dec 2012, Sasha Levin wrote:

 That's exactly what happens with the patch. Note that in the current upstream
 version there are several slab checks scattered all over.
 
 In this case for example, I'm removing it from __alloc_bootmem_node(), but the
 first code line of__alloc_bootmem_node_nopanic() is:
 
 if (WARN_ON_ONCE(slab_is_available()))
 return kzalloc(size, GFP_NOWAIT);
 

You're only talking about mm/bootmem.c and not mm/nobootmem.c, and notice 
that __alloc_bootmem_node() does not call __alloc_bootmem_node_nopanic(), 
it calls ___alloc_bootmem_node_nopanic().
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-27 Thread Sasha Levin
On 12/27/2012 06:04 PM, David Rientjes wrote:
 On Thu, 27 Dec 2012, Sasha Levin wrote:
 
 That's exactly what happens with the patch. Note that in the current upstream
 version there are several slab checks scattered all over.

 In this case for example, I'm removing it from __alloc_bootmem_node(), but 
 the
 first code line of__alloc_bootmem_node_nopanic() is:

 if (WARN_ON_ONCE(slab_is_available()))
 return kzalloc(size, GFP_NOWAIT);

 
 You're only talking about mm/bootmem.c and not mm/nobootmem.c, and notice 
 that __alloc_bootmem_node() does not call __alloc_bootmem_node_nopanic(), 
 it calls ___alloc_bootmem_node_nopanic().

Holy cow, this is an underscore hell.


Thanks,
Sasha

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/