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=-8.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 DDFB8C433E1 for ; Fri, 3 Jul 2020 16:18:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A793220884 for ; Fri, 3 Jul 2020 16:18:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A793220884 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 227B48D0090; Fri, 3 Jul 2020 12:18:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E2D18D0074; Fri, 3 Jul 2020 12:18:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0EDEA8D0090; Fri, 3 Jul 2020 12:18:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0070.hostedemail.com [216.40.44.70]) by kanga.kvack.org (Postfix) with ESMTP id E9D6D8D0074 for ; Fri, 3 Jul 2020 12:18:52 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A81315824 for ; Fri, 3 Jul 2020 16:18:52 +0000 (UTC) X-FDA: 76997273304.15.wheel54_2315a5f26e93 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 79B521814B0C8 for ; Fri, 3 Jul 2020 16:18:52 +0000 (UTC) X-HE-Tag: wheel54_2315a5f26e93 X-Filterd-Recvd-Size: 4116 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Jul 2020 16:18:51 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CCE0DAB98; Fri, 3 Jul 2020 16:18:50 +0000 (UTC) Subject: Re: [PATCH v3 8/8] mm/page_alloc: remove a wrapper for alloc_migration_target() To: js1304@gmail.com, Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@lge.com, Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , Michal Hocko , Joonsoo Kim References: <1592892828-1934-1-git-send-email-iamjoonsoo.kim@lge.com> <1592892828-1934-9-git-send-email-iamjoonsoo.kim@lge.com> From: Vlastimil Babka Message-ID: Date: Fri, 3 Jul 2020 18:18:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <1592892828-1934-9-git-send-email-iamjoonsoo.kim@lge.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 79B521814B0C8 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 6/23/20 8:13 AM, js1304@gmail.com wrote: > From: Joonsoo Kim > > There is a well-defined standard migration target callback. > Use it directly. > > Signed-off-by: Joonsoo Kim Acked-by: Vlastimil Babka But you could move this to patch 5/8 to reduce churn. And do the same with mm/memory-failure.c new_page() there really, to drop the simple wrappers. Only new_node_page() is complex enough. Hm wait, new_node_page() is only called by do_migrate_range() which is only called by __offline_pages() with explicit test that all pages are from a single zone, so the nmask could also be setup just once and not per each page, making it possible to remove the wrapper. But for new_page() you would have to define that mtc->nid == NUMA_NO_NODE means alloc_migrate_target() does page_to_nid(page) by itself. > --- > mm/page_alloc.c | 9 +++++++-- > mm/page_isolation.c | 11 ----------- > 2 files changed, 7 insertions(+), 13 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 9808339..884dfb5 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -8359,6 +8359,11 @@ static int __alloc_contig_migrate_range(struct compact_control *cc, > unsigned long pfn = start; > unsigned int tries = 0; > int ret = 0; > + struct migration_target_control mtc = { > + .nid = zone_to_nid(cc->zone), > + .nmask = &node_states[N_MEMORY], > + .gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL, > + }; > > migrate_prep(); > > @@ -8385,8 +8390,8 @@ static int __alloc_contig_migrate_range(struct compact_control *cc, > &cc->migratepages); > cc->nr_migratepages -= nr_reclaimed; > > - ret = migrate_pages(&cc->migratepages, alloc_migrate_target, > - NULL, 0, cc->mode, MR_CONTIG_RANGE); > + ret = migrate_pages(&cc->migratepages, alloc_migration_target, > + NULL, (unsigned long)&mtc, cc->mode, MR_CONTIG_RANGE); > } > if (ret < 0) { > putback_movable_pages(&cc->migratepages); > diff --git a/mm/page_isolation.c b/mm/page_isolation.c > index adba031..242c031 100644 > --- a/mm/page_isolation.c > +++ b/mm/page_isolation.c > @@ -306,14 +306,3 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn, > > return pfn < end_pfn ? -EBUSY : 0; > } > - > -struct page *alloc_migrate_target(struct page *page, unsigned long private) > -{ > - struct migration_target_control mtc = { > - .nid = page_to_nid(page), > - .nmask = &node_states[N_MEMORY], > - .gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL, > - }; > - > - return alloc_migration_target(page, (unsigned long)&mtc); > -} >