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.2 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 3B837C433E1 for ; Tue, 7 Jul 2020 16:34:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F3D4F20708 for ; Tue, 7 Jul 2020 16:34:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3D4F20708 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 F36CF6B008A; Tue, 7 Jul 2020 12:34:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE7CA6B008C; Tue, 7 Jul 2020 12:34:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E24206B0092; Tue, 7 Jul 2020 12:34:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0146.hostedemail.com [216.40.44.146]) by kanga.kvack.org (Postfix) with ESMTP id C705E6B008A for ; Tue, 7 Jul 2020 12:34:09 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8024B181AEF0B for ; Tue, 7 Jul 2020 16:34:09 +0000 (UTC) X-FDA: 77011827018.25.loss88_411082626eb5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 2246D1804E3A1 for ; Tue, 7 Jul 2020 16:34:09 +0000 (UTC) X-HE-Tag: loss88_411082626eb5 X-Filterd-Recvd-Size: 3837 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Jul 2020 16:34:08 +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 55A90B000; Tue, 7 Jul 2020 16:34:07 +0000 (UTC) Subject: Re: [PATCH v4 10/11] mm/memory-failure: remove a wrapper for alloc_migration_target() To: Michal Hocko , js1304@gmail.com Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@lge.com, Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , Joonsoo Kim References: <1594107889-32228-1-git-send-email-iamjoonsoo.kim@lge.com> <1594107889-32228-11-git-send-email-iamjoonsoo.kim@lge.com> <20200707114829.GL5913@dhcp22.suse.cz> From: Vlastimil Babka Message-ID: Date: Tue, 7 Jul 2020 17:03:50 +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: <20200707114829.GL5913@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 2246D1804E3A1 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 7/7/20 1:48 PM, Michal Hocko wrote: > On Tue 07-07-20 16:44:48, Joonsoo Kim wrote: >> From: Joonsoo Kim >> >> There is a well-defined standard migration target callback. Use it >> directly. >> >> Signed-off-by: Joonsoo Kim >> --- >> mm/memory-failure.c | 18 ++++++------------ >> 1 file changed, 6 insertions(+), 12 deletions(-) >> >> diff --git a/mm/memory-failure.c b/mm/memory-failure.c >> index 609d42b6..3b89804 100644 >> --- a/mm/memory-failure.c >> +++ b/mm/memory-failure.c >> @@ -1677,16 +1677,6 @@ int unpoison_memory(unsigned long pfn) >> } >> EXPORT_SYMBOL(unpoison_memory); >> >> -static struct page *new_page(struct page *p, unsigned long private) >> -{ >> - struct migration_target_control mtc = { >> - .nid = page_to_nid(p), >> - .gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL, >> - }; >> - >> - return alloc_migration_target(p, (unsigned long)&mtc); >> -} >> - >> /* >> * Safely get reference count of an arbitrary page. >> * Returns 0 for a free page, -EIO for a zero refcount page >> @@ -1793,6 +1783,10 @@ static int __soft_offline_page(struct page *page) >> const char *msg_page[] = {"page", "hugepage"}; >> bool huge = PageHuge(page); >> LIST_HEAD(pagelist); >> + struct migration_target_control mtc = { >> + .nid = NUMA_NO_NODE, >> + .gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL, >> + }; > > Is NUMA_NO_NODE really intended here? The original code has preferred to > stay on the same node. The alloc_migration_target() interprets NUMA_NO_NODE as a request to call page_to_nid(), so we don't need these thin wrappers that do just that. I have suggested this in v3 review and it's mentioned in 06/11. > If this is intentional then the changelog should > be explicit about that. > >> >> /* >> * Check PageHWPoison again inside page lock because PageHWPoison >> @@ -1829,8 +1823,8 @@ static int __soft_offline_page(struct page *page) >> } >> >> if (isolate_page(hpage, &pagelist)) { >> - ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL, >> - MIGRATE_SYNC, MR_MEMORY_FAILURE); >> + ret = migrate_pages(&pagelist, alloc_migration_target, NULL, >> + (unsigned long)&mtc, MIGRATE_SYNC, MR_MEMORY_FAILURE); >> if (!ret) { >> bool release = !huge; >> >> -- >> 2.7.4 >> >