Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932162AbbFLKHm (ORCPT ); Fri, 12 Jun 2015 06:07:42 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:37799 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753195AbbFLKHi convert rfc822-to-8bit (ORCPT ); Fri, 12 Jun 2015 06:07:38 -0400 From: Michal Nazarewicz To: Vlastimil Babka , Andrew Morton , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Vlastimil Babka , Minchan Kim , Mel Gorman , Joonsoo Kim , Naoya Horiguchi , Christoph Lameter , Rik van Riel , David Rientjes Subject: Re: [PATCH 3/6] mm, compaction: encapsulate resetting cached scanner positions In-Reply-To: <1433928754-966-4-git-send-email-vbabka@suse.cz> Organization: http://mina86.com/ References: <1433928754-966-1-git-send-email-vbabka@suse.cz> <1433928754-966-4-git-send-email-vbabka@suse.cz> User-Agent: Notmuch/0.19+53~g2e63a09 (http://notmuchmail.org) Emacs/25.0.50.1 (x86_64-unknown-linux-gnu) X-Face: PbkBB1w#)bOqd`iCe"Ds{e+!C7`pkC9a|f)Qo^BMQvy\q5x3?vDQJeN(DS?|-^$uMti[3D*#^_Ts"pU$jBQLq~Ud6iNwAw_r_o_4]|JO?]}P_}Nc&"p#D(ZgUb4uCNPe7~a[DbPG0T~!&c.y$Ur,=N4RT>]dNpd;KFrfMCylc}gc??'U2j,!8%xdD Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEWbfGlUPDDHgE57V0jUupKjgIObY0PLrom9mH4dFRK4gmjPs41MxjOgAAACQElEQVQ4jW3TMWvbQBQHcBk1xE6WyALX1069oZBMlq+ouUwpEQQ6uRjttkWP4CmBgGM0BQLBdPFZYPsyFUo6uEtKDQ7oy/U96XR2Ux8ehH/89Z6enqxBcS7Lg81jmSuujrfCZcLI/TYYvbGj+jbgFpHJ/bqQAUISj8iLyu4LuFHJTosxsucO4jSDNE0Hq3hwK/ceQ5sx97b8LcUDsILfk+ovHkOIsMbBfg43VuQ5Ln9YAGCkUdKJoXR9EclFBhixy3EGVz1K6eEkhxCAkeMMnqoAhAKwhoUJkDrCqvbecaYINlFKSRS1i12VKH1XpUd4qxL876EkMcDvHj3s5RBajHHMlA5iK32e0C7VgG0RlzFPvoYHZLRmAC0BmNcBruhkE0KsMsbEc62ZwUJDxWUdMsMhVqovoT96i/DnX/ASvz/6hbCabELLk/6FF/8PNpPCGqcZTGFcBhhAaZZDbQPaAB3+KrWWy2XgbYDNIinkdWAFcCpraDE/knwe5DBqGmgzESl1p2E4MWAz0VUPgYYzmfWb9yS4vCvgsxJriNTHoIBz5YteBvg+VGISQWUqhMiByPIPpygeDBE6elD973xWwKkEiHZAHKjhuPsFnBuArrzxtakRcISv+XMIPl4aGBUJm8Emk7qBYU8IlgNEIpiJhk/No24jHwkKTFHDWfPniR4iw5vJaw2nzSjfq2zffcE/GDjRC2dn0J0XwPAbDL84TvaFCJEU4Oml9pRyEUhR3Cl2t01AoEjRbs0sYugp14/4X5n4pU4EHHnMAAAAAElFTkSuQmCC X-PGP: 50751FF4 X-PGP-FP: AC1F 5F5C D418 88F8 CC84 5858 2060 4012 5075 1FF4 X-Hashcash: 1:20:150612:cl@linux.com::Q361US3wLAnjOkpX:0000014hC X-Hashcash: 1:20:150612:linux-kernel@vger.kernel.org::CWiCEwYh97/ld9Bd:0000000000000000000000000000000000BWH X-Hashcash: 1:20:150612:linux-mm@kvack.org::3LDKldY7MyJFSuOA:00000000000000000000000000000000000000000000DNT X-Hashcash: 1:20:150612:mgorman@suse.de::tANID+olpGWC6+d4:001VBd X-Hashcash: 1:20:150612:riel@redhat.com::/EDHinNEZhJ+Cf7M:002BP8 X-Hashcash: 1:20:150612:akpm@linux-foundation.org::VDAdET+XPqwI3bF7:0000000000000000000000000000000000001hZM X-Hashcash: 1:20:150612:rientjes@google.com::IMzy0IVaYdpRkpaU:0000000000000000000000000000000000000000001jl5 X-Hashcash: 1:20:150612:iamjoonsoo.kim@lge.com::tKVWY8u/B6jM2jWf:0000000000000000000000000000000000000002RFs X-Hashcash: 1:20:150612:minchan@kernel.org::1FmiVW2R3XM7qKVI:000000000000000000000000000000000000000000027DW X-Hashcash: 1:20:150612:vbabka@suse.cz::rqDpnhAAnwN8eueQ:0005gYj X-Hashcash: 1:20:150612:n-horiguchi@ah.jp.nec.com::HgdQ5gzK0PAAHv7O:0000000000000000000000000000000000006uup X-Hashcash: 1:20:150612:vbabka@suse.cz::Rdb4oq3R9Opzzj26:0009L01 Date: Fri, 12 Jun 2015 12:07:35 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3926 Lines: 99 On Wed, Jun 10 2015, Vlastimil Babka wrote: > Resetting the cached compaction scanner positions is now done implicitly in > __reset_isolation_suitable() and compact_finished(). Encapsulate the > functionality in a new function reset_cached_positions() and call it explicitly > where needed. > > Signed-off-by: Vlastimil Babka > Cc: Minchan Kim > Cc: Mel Gorman > Cc: Joonsoo Kim > Cc: Michal Nazarewicz Acked-by: Michal Nazarewicz > Cc: Naoya Horiguchi > Cc: Christoph Lameter > Cc: Rik van Riel > Cc: David Rientjes > --- > mm/compaction.c | 22 ++++++++++++++-------- > 1 file changed, 14 insertions(+), 8 deletions(-) > > diff --git a/mm/compaction.c b/mm/compaction.c > index 7e0a814..d334bb3 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -207,6 +207,13 @@ static inline bool isolation_suitable(struct compact_control *cc, > return !get_pageblock_skip(page); > } > > +static void reset_cached_positions(struct zone *zone) > +{ > + zone->compact_cached_migrate_pfn[0] = zone->zone_start_pfn; > + zone->compact_cached_migrate_pfn[1] = zone->zone_start_pfn; > + zone->compact_cached_free_pfn = zone_end_pfn(zone); > +} > + > /* > * This function is called to clear all cached information on pageblocks that > * should be skipped for page isolation when the migrate and free page scanner > @@ -218,9 +225,6 @@ static void __reset_isolation_suitable(struct zone *zone) > unsigned long end_pfn = zone_end_pfn(zone); > unsigned long pfn; > > - zone->compact_cached_migrate_pfn[0] = start_pfn; > - zone->compact_cached_migrate_pfn[1] = start_pfn; > - zone->compact_cached_free_pfn = end_pfn; > zone->compact_blockskip_flush = false; > > /* Walk the zone and mark every pageblock as suitable for isolation */ > @@ -250,8 +254,10 @@ void reset_isolation_suitable(pg_data_t *pgdat) > continue; > > /* Only flush if a full compaction finished recently */ > - if (zone->compact_blockskip_flush) > + if (zone->compact_blockskip_flush) { > __reset_isolation_suitable(zone); > + reset_cached_positions(zone); > + } > } > } > > @@ -1164,9 +1170,7 @@ static int __compact_finished(struct zone *zone, struct compact_control *cc, > /* Compaction run completes if the migrate and free scanner meet */ > if (compact_scanners_met(cc)) { > /* Let the next compaction start anew. */ > - zone->compact_cached_migrate_pfn[0] = zone->zone_start_pfn; > - zone->compact_cached_migrate_pfn[1] = zone->zone_start_pfn; > - zone->compact_cached_free_pfn = zone_end_pfn(zone); > + reset_cached_positions(zone); > > /* > * Mark that the PG_migrate_skip information should be cleared > @@ -1329,8 +1333,10 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) > * is about to be retried after being deferred. kswapd does not do > * this reset as it'll reset the cached information when going to sleep. > */ > - if (compaction_restarting(zone, cc->order) && !current_is_kswapd()) > + if (compaction_restarting(zone, cc->order) && !current_is_kswapd()) { > __reset_isolation_suitable(zone); > + reset_cached_positions(zone); > + } > > /* > * Setup to move all movable pages to the end of the zone. Used cached > -- > 2.1.4 > -- Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o ..o | Computer Science, Michał “mina86” Nazarewicz (o o) ooo +------ooO--(_)--Ooo-- -- 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/