[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140925061331.GA23558@js1304-P5Q-DELUXE>
Date: Thu, 25 Sep 2014 15:13:31 +0900
From: Joonsoo Kim <iamjoonsoo.kim@....com>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Rik van Riel <riel@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Mel Gorman <mgorman@...e.de>,
Johannes Weiner <hannes@...xchg.org>,
Minchan Kim <minchan@...nel.org>,
Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>,
Zhang Yanfei <zhangyanfei@...fujitsu.com>,
"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
Tang Chen <tangchen@...fujitsu.com>,
Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Wen Congyang <wency@...fujitsu.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Michal Nazarewicz <mina86@...a86.com>,
Laura Abbott <lauraa@...eaurora.org>,
Heesub Shin <heesub.shin@...sung.com>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
Ritesh Harjani <ritesh.list@...il.com>,
t.stanislaws@...sung.com, Gioh Kim <gioh.kim@....com>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v3 1/4] mm/page_alloc: fix incorrect isolation
behavior by rechecking migratetype
On Wed, Sep 24, 2014 at 03:30:26PM +0200, Vlastimil Babka wrote:
> On 09/15/2014 04:31 AM, Joonsoo Kim wrote:
> >On Mon, Sep 08, 2014 at 10:31:29AM +0200, Vlastimil Babka wrote:
> >>On 08/26/2014 10:08 AM, Joonsoo Kim wrote:
> >>
> >>>diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> >>>index f86023b..51e0d13 100644
> >>>--- a/mm/page_alloc.c
> >>>+++ b/mm/page_alloc.c
> >>>@@ -740,9 +740,15 @@ static void free_one_page(struct zone *zone,
> >>> if (nr_scanned)
> >>> __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned);
> >>>
> >>>+ if (unlikely(has_isolate_pageblock(zone))) {
> >>>+ migratetype = get_pfnblock_migratetype(page, pfn);
> >>>+ if (is_migrate_isolate(migratetype))
> >>>+ goto skip_counting;
> >>>+ }
> >>>+ __mod_zone_freepage_state(zone, 1 << order, migratetype);
> >>>+
> >>>+skip_counting:
> >>
> >>Here, wouldn't a simple 'else __mod_zone_freepage_state...' look
> >>better than goto + label? (same for the following 2 patches). Or
> >>does that generate worse code?
> >
> >To remove goto label, we need two __mod_zone_freepage_state() like
> >as below. On my system, it doesn't generate worse code, but, I am not
> >sure that this is true if more logic would be added. I think that
> >goto + label is better.
>
> Oh right, I missed that. It's a bit subtle, but I don't see a nicer
> solution right now.
>
> >+ if (unlikely(has_isolate_pageblock(zone))) {
> >+ migratetype = get_pfnblock_migratetype(page, pfn);
> >+ if (!is_migrate_isolate(migratetype))
> >+ __mod_zone_freepage_state(zone, 1 << order, migratetype);
> >+ } else {
> >+ __mod_zone_freepage_state(zone, 1 << order, migratetype);
> > }
> >
>
> Yeah that would be uglier I guess.
>
> >Anyway, What do you think which one is better, either v2 or v3? Still, v3? :)
>
> Yeah v3 is much better than v1 was, and better for backporting than
> v2. The changelogs also look quite clear. The overhead shouldn't be
> bad with the per-zone flag guarding get_pfnblock_migratetype.
Okay. I will go this way. :)
>
> I'm just not sure about patch 4 and potentially leaving unmerged
> budies behind. How would it look if instead we made sure isolation
> works on whole MAX_ORDER blocks instead?
>
If alloc_contig_range() succeed, and later, free_contig_range() is
called for free, there would be no leaving unmerged buddies.
If we fail on alloc_contig_range(), we can get unmerged buddies, but,
that's rare case and it's not big matter because normally we don't
want to allocate page with MAXORDER-1. We mostly want to allocate page
with pageblock_order at maximum. After some split and merging of freepage,
freepage could be MAXORDER-1 page again so that's not real issue, IMO.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists