From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94344C43387 for ; Thu, 17 Jan 2019 17:01:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D70420652 for ; Thu, 17 Jan 2019 17:01:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729229AbfAQRBV (ORCPT ); Thu, 17 Jan 2019 12:01:21 -0500 Received: from mx2.suse.de ([195.135.220.15]:57134 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728649AbfAQRBV (ORCPT ); Thu, 17 Jan 2019 12:01:21 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D0049AE27; Thu, 17 Jan 2019 17:01:19 +0000 (UTC) Subject: Re: [PATCH 16/25] mm, compaction: Check early for huge pages encountered by the migration scanner To: Mel Gorman , Linux-MM Cc: David Rientjes , Andrea Arcangeli , ying.huang@intel.com, kirill@shutemov.name, Andrew Morton , Linux List Kernel Mailing References: <20190104125011.16071-1-mgorman@techsingularity.net> <20190104125011.16071-17-mgorman@techsingularity.net> From: Vlastimil Babka Message-ID: <724b7599-8300-15b5-2675-eecab2450f45@suse.cz> Date: Thu, 17 Jan 2019 18:01:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190104125011.16071-17-mgorman@techsingularity.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/4/19 1:50 PM, Mel Gorman wrote: > When scanning for sources or targets, PageCompound is checked for huge > pages as they can be skipped quickly but it happens relatively late after > a lot of setup and checking. This patch short-cuts the check to make it > earlier. It might still change when the lock is acquired but this has > less overhead overall. The free scanner advances but the migration scanner > does not. Typically the free scanner encounters more movable blocks that > change state over the lifetime of the system and also tends to scan more > aggressively as it's actively filling its portion of the physical address > space with data. This could change in the future but for the moment, > this worked better in practice and incurred fewer scan restarts. > > The impact on latency and allocation success rates is marginal but the > free scan rates are reduced by 32% and system CPU usage is reduced by > 2.6%. The 2-socket results are not materially different. Hmm, interesting that adjusting migrate scanner affected free scanner. Oh well. > Signed-off-by: Mel Gorman Acked-by: Vlastimil Babka Nit below. > --- > mm/compaction.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/mm/compaction.c b/mm/compaction.c > index 608d274f9880..921720f7a416 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -1071,6 +1071,9 @@ static bool suitable_migration_source(struct compact_control *cc, > { > int block_mt; > > + if (pageblock_skip_persistent(page)) > + return false; > + > if ((cc->mode != MIGRATE_ASYNC) || !cc->direct_compaction) > return true; > > @@ -1693,12 +1696,17 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone, > continue; > > /* > - * For async compaction, also only scan in MOVABLE blocks. > - * Async compaction is optimistic to see if the minimum amount > - * of work satisfies the allocation. > + * For async compaction, also only scan in MOVABLE blocks > + * without huge pages. Async compaction is optimistic to see > + * if the minimum amount of work satisfies the allocation. > + * The cached PFN is updated as it's possible that all > + * remaining blocks between source and target are suitable ^ unsuitable? > + * and the compaction scanners fail to meet. > */ > - if (!suitable_migration_source(cc, page)) > + if (!suitable_migration_source(cc, page)) { > + update_cached_migrate(cc, block_end_pfn); > continue; > + } > > /* Perform the isolation */ > low_pfn = isolate_migratepages_block(cc, low_pfn, >