Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758769Ab2HXJoZ (ORCPT ); Fri, 24 Aug 2012 05:44:25 -0400 Received: from cantor2.suse.de ([195.135.220.15]:54509 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754493Ab2HXJoU (ORCPT ); Fri, 24 Aug 2012 05:44:20 -0400 Date: Fri, 24 Aug 2012 11:44:15 +0200 From: Michal Hocko To: Li Haifeng Cc: Gavin Shan , Andrew Morton , Mel Gorman , Minchan Kim , Johannes Weiner , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: Fixup the page of buddy_higher address's calculation Message-ID: <20120824094415.GD29282@dhcp22.suse.cz> References: <20120823095022.GB10685@dhcp22.suse.cz> <20120823135839.GB19968@dhcp22.suse.cz> <20120824080626.GC29282@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4247 Lines: 105 On Fri 24-08-12 17:08:36, Li Haifeng wrote: > 2012/8/24 Michal Hocko : > > On Fri 24-08-12 10:08:20, Li Haifeng wrote: > > [...] > >> Subject: [PATCH] Fix the page address of higher page's buddy calculation > >> > >> Calculate the page address of higher page's buddy should be based > >> higher_page with the offset between index of higher page and > >> index of higher page's buddy. > > > > Sorry for insisting but could you add an information about when this has > > been introduced (I have mentioned the commit in the other email) and the > > effect of the bug so that we can consider whether this is worth > > backporting to stable trees. > > > >> Signed-off-by: Haifeng Li > >> Signed-off-by: Gavin Shan > > > > Other than that > > Reviewed-by: Michal Hocko > > > >> --- > >> mm/page_alloc.c | 2 +- > >> 1 files changed, 1 insertions(+), 1 deletions(-) > >> > >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c > >> index cdef1d4..642cd62 100644 > >> --- a/mm/page_alloc.c > >> +++ b/mm/page_alloc.c > >> @@ -536,7 +536,7 @@ static inline void __free_one_page(struct page *page, > >> combined_idx = buddy_idx & page_idx; > >> higher_page = page + (combined_idx - page_idx); > >> buddy_idx = __find_buddy_index(combined_idx, order + 1); > >> - higher_buddy = page + (buddy_idx - combined_idx); > >> + higher_buddy = higher_page + (buddy_idx - combined_idx); > >> if (page_is_buddy(higher_page, higher_buddy, order + 1)) { > >> list_add_tail(&page->lru, > >> &zone->free_area[order].free_list[migratetype]); > >> -- > >> 1.7.5.4 > > > > -- > > Michal Hocko > > SUSE Labs > > I am sorry Michal. I misinterpreted what you mean. > > And the post blow is OK? > ------------------------------------------> > Subject: [PATCH] Fix the page address of higher page's buddy calculation > > The heuristic method for buddy has been introduced since > 43506fad(mm/page_alloc.c: simplify calculation of combined index > of adjacent buddy lists). Maybe I just misunderstood you here but the heuristic has been introduced by 6dda9d55 (page allocator: reduce fragmentation in buddy allocator by adding buddies that are merging to the tail of the free lists) and the commit you are mentioning broke it. > But the page address of higher page's buddy was wrongly calculated, > which will lead page_is_buddy to fail for ever. IOW, the heuristic > method would be disabled with the wrong page address of higher page's > buddy. > > Calculating the page address of higher page's buddy should be based > higher_page with the offset between index of higher page and > index of higher page's buddy. > I would also add CC: stable [2.6.38+] although it is not clear how much the heuristic is helpful. Anyway it's a regression and should be fix IMHO. > Signed-off-by: Haifeng Li > Signed-off-by: Gavin Shan > Reviewed-by: Michal Hocko > --- > mm/page_alloc.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index ddbc17d..0754a3c 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -579,7 +579,7 @@ static inline void __free_one_page(struct page *page, > combined_idx = buddy_idx & page_idx; > higher_page = page + (combined_idx - page_idx); > buddy_idx = __find_buddy_index(combined_idx, order + 1); > - higher_buddy = page + (buddy_idx - combined_idx); > + higher_buddy = higher_page + (buddy_idx - combined_idx); > if (page_is_buddy(higher_page, higher_buddy, order + 1)) { > list_add_tail(&page->lru, > &zone->free_area[order].free_list[migratetype]); > -- > 1.7.5.4 -- Michal Hocko SUSE Labs -- 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/