Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2450328ybt; Fri, 3 Jul 2020 09:19:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs2/yrnWq2dCj+I1RAF4PK3Co4UwNIzYmOm4uZmz9yTu8pii2DsdKUsR+QsOL+bnIFKxhI X-Received: by 2002:a50:e408:: with SMTP id d8mr40477411edm.375.1593793167413; Fri, 03 Jul 2020 09:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593793167; cv=none; d=google.com; s=arc-20160816; b=WaByv9J5E0z43pC2KJZr4PFhX5lmzSuweI61I/6KHfzsLUQGRguHjmRxz5HyBGyZHQ leMvp0uBvVzFe3pX0wK33bsHV5uY4rFUpWu9FzfE28LkVE7YcYanNF2JP8y21sQEHXHD g4iTGTbcH2PZTZFeHYOsnWcd0gjqqqY/Otl9AFGQlZmmAyRopmxm6Ns52gEo0cYYm9hs Px4DPqYnQz+Ysl3fuNnCQTTPeTO0XNqrkGcQNXDL3f6+wIN+FjgIrCzlTdoYmBnbasgi buwahvPJSKV8L0rUzSqs/lGl2RfsAin07H4KJTEX9PV7+V95TjlG7MJCqL2gfyiPEOiH UjFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Qc6WdWXtY4WqC0ztFQTDi5kEQ28nd7JMe1fEp0aIeRo=; b=ByFBT25qLvlzEj4SuK/DLplAZ5JDfmRISNzrFpw3n79pBNlBmaLD3kcGcZpufsM2tM lnYfE1hoYmLi9cJWmCaG0qkSedYil9AFBSYxalseGsj7bdZBoo5/IFch9zcvcwobe27d 5LQYNCojd53LKd3+avoLXghRy6e9uUZzV9hbuBoiYJdLhVW5wyoF3REToWivAR77qDpQ gPIKUuO+kQLKvLdJd9cwjGYQwKA6/5CB/2OENqZ1r6VPrKQpjq3KnB3bVUu4Wsl3+7r+ 8GlCijSGHFHEx21ilMSY3IxMqrrmUpg+OIgF6JfXusnm0oRa31bysEgdZJ8h0C6m8O4+ MjZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b4si8643122edk.454.2020.07.03.09.19.04; Fri, 03 Jul 2020 09:19:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726345AbgGCQSw (ORCPT + 99 others); Fri, 3 Jul 2020 12:18:52 -0400 Received: from mx2.suse.de ([195.135.220.15]:40504 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726098AbgGCQSw (ORCPT ); Fri, 3 Jul 2020 12:18:52 -0400 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); > -} >