Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1188241ybt; Tue, 7 Jul 2020 09:37:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjZ2aCJqgvt8r8XoXtrx62GM7D+fXU7lk2DAxCnhdhl9x1V5fW8Z8JmLBSFOimvcUoJkVy X-Received: by 2002:aa7:c442:: with SMTP id n2mr51819444edr.309.1594139866388; Tue, 07 Jul 2020 09:37:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594139866; cv=none; d=google.com; s=arc-20160816; b=u/vAJE0/N1t0zCeygacgXJF8gXkKulpbNVK/worx6eTMgJg6FItL6++Leqwocdo3po cyGEvceLgSKOk2B7EjKhxt6SWXT2h5HeK/Hvsi7gHISnnojAWB1/qK5ZD6y63dw+4+55 DQWmimqITwTexFUmKr6LFvjFbYabpWoHqYyt/mvNnzSoBqIz4rLIcRy9p5grOsBQNCvF kmQmOGLr3VFTC5XGZva2IoLlY63sIbkFHTjAG+qjbtMRZdMC7LPBfsz3cSsNzsPE7Bxx Nu+NMsTq+OM4uhd9OsEmtwkX1W+72Em3of6qH+t859D7ZDvrzaM/cZEr3z6Y+LUjG0VT OJ4A== 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=5djTn2o8dkHanhCkhirbaTGEbza2c5ZbETZfVQOcGxo=; b=O62QIV8PiWGINl+NTmAbY8ZXL08S+RyHop6Q11B2mcisl7ZG9C5pBXG6E0CCWV3Xbo li7yro6F1wCnq59D37dM9osyy6ULuY55YCNcZmDvy9A+4nMaZQO2zRxZUHMKUxM0Qmbq vdIkeXlD6tv5bCHEy86XCySfG2dgnC2JWeNIa3VRCOzOe8T230NCwwRb4jO0gwIVThio yHv64ASh+2J9r7fzgDR/F/+UJ15owiIGUdP4FCGmm+DVfHlUpuPTfAKgaoWVictz4rXX 5y9Jd1SyYirPcRJCv6T7msJKYZp4yO1mLoJIalC3T/D/PikH2N1uv2SStu+ot8H1lOrC Fkiw== 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 p13si14713769edm.441.2020.07.07.09.37.22; Tue, 07 Jul 2020 09:37:46 -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 S1727975AbgGGQeI (ORCPT + 99 others); Tue, 7 Jul 2020 12:34:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:45492 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726911AbgGGQeI (ORCPT ); Tue, 7 Jul 2020 12:34:08 -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 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> >