linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/slab: remove duplicate check
@ 2012-05-11  9:16 Gavin Shan
  2012-05-14 20:42 ` Johannes Weiner
  0 siblings, 1 reply; 3+ messages in thread
From: Gavin Shan @ 2012-05-11  9:16 UTC (permalink / raw)
  To: linux-mm; +Cc: hannes, akpm, Gavin Shan

While allocateing pages using buddy allocator, the compound page
is probably split up to free pages. Under the circumstance, the
compound page should be destroied by function destroy_compound_page().
However, there has duplicate check to judge if the page is compound
one.

The patch removes the duplicate check since the function compound_order()
will returns 0 while the page hasn't PG_head set in function destroy_compound_page().
That's to say, the function destroy_compound_page() needn't check
PG_head any more through function PageHead().

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

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a712fb9..1277632 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -363,8 +363,7 @@ static int destroy_compound_page(struct page *page, unsigned long order)
 	int nr_pages = 1 << order;
 	int bad = 0;
 
-	if (unlikely(compound_order(page) != order) ||
-	    unlikely(!PageHead(page))) {
+	if (unlikely(compound_order(page) != order)) {
 		bad_page(page);
 		bad++;
 	}
-- 
1.7.5.4

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm/slab: remove duplicate check
  2012-05-11  9:16 [PATCH] mm/slab: remove duplicate check Gavin Shan
@ 2012-05-14 20:42 ` Johannes Weiner
  2012-05-15  9:19   ` Gavin Shan
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Weiner @ 2012-05-14 20:42 UTC (permalink / raw)
  To: Gavin Shan; +Cc: linux-mm, akpm

On Fri, May 11, 2012 at 05:16:09PM +0800, Gavin Shan wrote:
> While allocateing pages using buddy allocator, the compound page
> is probably split up to free pages. Under the circumstance, the
> compound page should be destroied by function destroy_compound_page().
> However, there has duplicate check to judge if the page is compound
> one.
> 
> The patch removes the duplicate check since the function compound_order()
> will returns 0 while the page hasn't PG_head set in function destroy_compound_page().
> That's to say, the function destroy_compound_page() needn't check
> PG_head any more through function PageHead().
> 
> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>

Looks good!

But the slab in the subject suggests it would not affect other parts
of mm, while it actually affects THP, too.  Should probably be
removed?

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm/slab: remove duplicate check
  2012-05-14 20:42 ` Johannes Weiner
@ 2012-05-15  9:19   ` Gavin Shan
  0 siblings, 0 replies; 3+ messages in thread
From: Gavin Shan @ 2012-05-15  9:19 UTC (permalink / raw)
  To: Johannes Weiner; +Cc: linux-mm, akpm

>> While allocateing pages using buddy allocator, the compound page
>> is probably split up to free pages. Under the circumstance, the
>> compound page should be destroied by function destroy_compound_page().
>> However, there has duplicate check to judge if the page is compound
>> one.
>> 
>> The patch removes the duplicate check since the function compound_order()
>> will returns 0 while the page hasn't PG_head set in function destroy_compound_page().
>> That's to say, the function destroy_compound_page() needn't check
>> PG_head any more through function PageHead().
>> 
>> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
>
>Looks good!
>
>But the slab in the subject suggests it would not affect other parts
>of mm, while it actually affects THP, too.  Should probably be
>removed?
>
>Acked-by: Johannes Weiner <hannes@cmpxchg.org>
>

Thanks for looking into this, Johannes :-)

I'm not sure I should change the subject to "mm: xxx" and resend it
since it has been put into linux-mm next tree as the maillist mm-commits
told me. By the way, I even don't know how linux-mm next got sychronized
with linux mainline yet :-)

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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2012-05-15  9:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-11  9:16 [PATCH] mm/slab: remove duplicate check Gavin Shan
2012-05-14 20:42 ` Johannes Weiner
2012-05-15  9:19   ` 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).