linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/buddy: more comments for skip_free_areas_node()
@ 2012-07-06  3:24 Gavin Shan
  2012-07-06  5:42 ` Cong Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Gavin Shan @ 2012-07-06  3:24 UTC (permalink / raw)
  To: linux-mm; +Cc: xiyou.wangcong, akpm, Gavin Shan

The initial idea comes from Cong Wang. We're running out of memory
while calling function skip_free_areas_node(). So it would be unsafe
to allocate more memory from either stack or heap. The patche adds
more comments to address that.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
 mm/page_alloc.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4403009..c74f5a9 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2737,6 +2737,9 @@ void si_meminfo_node(struct sysinfo *val, int nid)
 /*
  * Determine whether the node should be displayed or not, depending on whether
  * SHOW_MEM_FILTER_NODES was passed to show_free_areas().
+ *
+ * We're running out of memory while calling the function. So don't allocate
+ * more memory from either stack or heap.
  */
 bool skip_free_areas_node(unsigned int flags, int nid)
 {
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/buddy: more comments for skip_free_areas_node()
  2012-07-06  3:24 [PATCH] mm/buddy: more comments for skip_free_areas_node() Gavin Shan
@ 2012-07-06  5:42 ` Cong Wang
  2012-07-06  5:46   ` Gavin Shan
  0 siblings, 1 reply; 5+ messages in thread
From: Cong Wang @ 2012-07-06  5:42 UTC (permalink / raw)
  To: Gavin Shan; +Cc: linux-mm, akpm

On Fri, Jul 6, 2012 at 11:24 AM, Gavin Shan <shangw@linux.vnet.ibm.com> wrote:
> The initial idea comes from Cong Wang. We're running out of memory
> while calling function skip_free_areas_node(). So it would be unsafe
> to allocate more memory from either stack or heap. The patche adds
> more comments to address that.

I think these comments should add to show_free_areas(),
not skip_free_areas_node().

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/buddy: more comments for skip_free_areas_node()
  2012-07-06  5:42 ` Cong Wang
@ 2012-07-06  5:46   ` Gavin Shan
  2012-07-09 21:21     ` David Rientjes
  0 siblings, 1 reply; 5+ messages in thread
From: Gavin Shan @ 2012-07-06  5:46 UTC (permalink / raw)
  To: Cong Wang; +Cc: Gavin Shan, linux-mm, akpm

On Fri, Jul 06, 2012 at 01:42:39PM +0800, Cong Wang wrote:
>On Fri, Jul 6, 2012 at 11:24 AM, Gavin Shan <shangw@linux.vnet.ibm.com> wrote:
>> The initial idea comes from Cong Wang. We're running out of memory
>> while calling function skip_free_areas_node(). So it would be unsafe
>> to allocate more memory from either stack or heap. The patche adds
>> more comments to address that.
>
>I think these comments should add to show_free_areas(),
>not skip_free_areas_node().
>

aha, exactly. Thanks a lot, Cong.

Thanks,
Gavin

>--
>To unsubscribe, send a message with 'unsubscribe linux-mm' in
>the body to majordomo@kvack.org.  For more info on Linux MM,
>see: http://www.linux-mm.org/ .
>Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/buddy: more comments for skip_free_areas_node()
  2012-07-06  5:46   ` Gavin Shan
@ 2012-07-09 21:21     ` David Rientjes
  2012-07-10  0:51       ` Gavin Shan
  0 siblings, 1 reply; 5+ messages in thread
From: David Rientjes @ 2012-07-09 21:21 UTC (permalink / raw)
  To: Gavin Shan; +Cc: Cong Wang, linux-mm, akpm

On Fri, 6 Jul 2012, Gavin Shan wrote:

> >> The initial idea comes from Cong Wang. We're running out of memory
> >> while calling function skip_free_areas_node(). So it would be unsafe
> >> to allocate more memory from either stack or heap. The patche adds
> >> more comments to address that.
> >
> >I think these comments should add to show_free_areas(),
> >not skip_free_areas_node().
> >
> 
> aha, exactly. Thanks a lot, Cong.
> 

There are two issues you're trying to describe here that I told you about:

 - allocating memory on the stack when called in a potentially very deep 
   call chain, and

 - dynamically allocating memory in oom conditions.

There are thousands of functions that could be called potentially very 
deep in a call chain, there's nothing special about this one besides the 
fact that you tried to optimize it by allocating a nodemask on the stack 
in a previous patch.

show_mem(), which calls show_free_areas(), is also not called only in oom 
conditions so the comment wouldn't apply at all.

In other words, there's nothing special about this particular function 
with regard to these traits.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/buddy: more comments for skip_free_areas_node()
  2012-07-09 21:21     ` David Rientjes
@ 2012-07-10  0:51       ` Gavin Shan
  0 siblings, 0 replies; 5+ messages in thread
From: Gavin Shan @ 2012-07-10  0:51 UTC (permalink / raw)
  To: David Rientjes; +Cc: Gavin Shan, Cong Wang, linux-mm, akpm

On Mon, Jul 09, 2012 at 02:21:07PM -0700, David Rientjes wrote:
>On Fri, 6 Jul 2012, Gavin Shan wrote:
>
>> >> The initial idea comes from Cong Wang. We're running out of memory
>> >> while calling function skip_free_areas_node(). So it would be unsafe
>> >> to allocate more memory from either stack or heap. The patche adds
>> >> more comments to address that.
>> >
>> >I think these comments should add to show_free_areas(),
>> >not skip_free_areas_node().
>> >
>> 
>> aha, exactly. Thanks a lot, Cong.
>> 
>
>There are two issues you're trying to describe here that I told you about:
>
> - allocating memory on the stack when called in a potentially very deep 
>   call chain, and
>
> - dynamically allocating memory in oom conditions.
>
>There are thousands of functions that could be called potentially very 
>deep in a call chain, there's nothing special about this one besides the 
>fact that you tried to optimize it by allocating a nodemask on the stack 
>in a previous patch.
>
>show_mem(), which calls show_free_areas(), is also not called only in oom 
>conditions so the comment wouldn't apply at all.
>
>In other words, there's nothing special about this particular function 
>with regard to these traits.
>

Thanks for your review, David. So please drop it :-)

Thanks,
Gavin

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-10  0:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-06  3:24 [PATCH] mm/buddy: more comments for skip_free_areas_node() Gavin Shan
2012-07-06  5:42 ` Cong Wang
2012-07-06  5:46   ` Gavin Shan
2012-07-09 21:21     ` David Rientjes
2012-07-10  0:51       ` Gavin Shan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).