From patchwork Thu Sep 21 07:44:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13393706 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 780F8CD5BD5 for ; Thu, 21 Sep 2023 07:46:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1544E6B0175; Thu, 21 Sep 2023 03:46:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 103516B0179; Thu, 21 Sep 2023 03:46:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F34E46B0184; Thu, 21 Sep 2023 03:46:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E32B36B0175 for ; Thu, 21 Sep 2023 03:46:04 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A139E80FE7 for ; Thu, 21 Sep 2023 07:46:04 +0000 (UTC) X-FDA: 81259821048.24.C57A39A Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf22.hostedemail.com (Postfix) with ESMTP id 2B9A7C0009 for ; Thu, 21 Sep 2023 07:46:01 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695282362; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uPXv4KuxwnoLpD+Fz5M9itVod0PMy/6XrloeJ6kolxs=; b=QfULnbyfEi6fOMHFdm+qRPOE6jlrsHaqmswvtdpLep9AxBEa5SD185mGvSsXcmOO5rZopp /hwYYQ8TuCP77gkD5hOyiZuaiQyQwxXRRJVK2nDdXwMlbHZOT3ZdsQlWwWx/WOFj7dx7EI Y6SAmfEdoKr7TMCcuONQkgUJ1KCUJo8= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695282362; a=rsa-sha256; cv=none; b=iX7QecA0v8rq5BN5GpqzKu31sE9yilBh6yPVhua0Uwlh3qECZ8l31Oru27ggbB59K3Jw60 N7R4uv49leIcl/OWWcLQUx6xYctzpiqLO/xLsHaLRaQUp5Ie/aRb55cwsqHqEG2EJAMA0d MxYmVrn7ZytmzB+LZo5a1kgcIoEacEU= Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RrnSL6bjnzVl9m; Thu, 21 Sep 2023 15:42:58 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 21 Sep 2023 15:45:57 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Mike Kravetz , , Kefeng Wang Subject: [PATCH v2 4/6] mm: memory: make numa_migrate_prep() to take a folio Date: Thu, 21 Sep 2023 15:44:15 +0800 Message-ID: <20230921074417.24004-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230921074417.24004-1-wangkefeng.wang@huawei.com> References: <20230921074417.24004-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 2B9A7C0009 X-Rspam-User: X-Stat-Signature: i8cqjzzzkphyp5tnqkwuqt1yei5j3x3n X-Rspamd-Server: rspam01 X-HE-Tag: 1695282361-808834 X-HE-Meta: U2FsdGVkX1+b/DO9WV+R/5w/olVg2qCI7D94HDgeRyNiTNSzGCVsFPcGOVnoG6dghUkn0JIqm62WzSlmXTKD7ihp+Z0TjZhg5TPZ5x4rs+3vgA3v4LDQBSsh/KthPhCKYtuMm10L1XZkxN58ylLAdezstNgxQYchX5UCXhl7hKaSKVG1H/uNEO3jXjwTsufdI5M8n06Kt3NRAGtw6kDMV3p/qV9DtAHT95ELt0gRWS43smO5DeJbr3NW1ViFFjSyPmiO1ytBvMZ9kGHhAn8OkoCLrzHbDwcDVdETGlYM8f1A8oZ6z6JdwlSOYcXage5laJREsFDgHrBjoAXsCnAqQJpyqjpbqotWL2NgsAsfgBO9tLmdcfe+t9POy/0R8rKAgCBKSD/c+5FD4mhSs+W/nYz9UV3aoh67Bt4V2ZLJKmtUAR+n4Y9DmGiC71A9cI0yfyV16aUMzck+XT1Zj871cXzL+4ZYOeE5ocj8rXGojiLB+01m9/IqHooW/GFBxUFP2f9EkHqbZ9igR3nRvPQ81FXPATVjL3uXXJOj8l7iNGCw73nCgEUqTdSJVB4BqB39k13SWeDqKs5ghKxjt57kGsARJJBL5CbxZd3aVx5NadhgyDh4QVJoxVbJAtxzqzDt9pRXhxBGnCkEqDQYOj4n3aleUUY1AtRGb56J8CNyZ5feIca63P0AOBMyplap1RdrYTtxqjarHQMQ3+nOFfJ4WEDL688x5mQnbeZmOupq63PqGx4l5FdzktchMBCpla4HSnz7PE8Wsrz8HFz73Tz5kPXw6xTzB4tvqRe+qMxFwTelEKM5+xeMXI6LCf0XzPjJWTxrhKeGIGb/pw6IcsXB+T/+91obB3iVHwAEucy46v5NoGsJu+zzxJurYo0UzjSrVxnaPRjjIucjfovnSdO+1yzf/3qLn1i0p0c2zcXGq/4duoydFLIOOxpHdGA4NLgAUE8lOTWg6owv1weFXQP 5g5jA7+h ybcTNlaxil3a3XBK3U6punH0MhzjQCXc+3cAgG5Ub5f2OjGyn7/U4iqqc+W+ImApxbooasSEV/YDhpekjoOnGfMocEGkBFJmr2G4tJo83t/MrYN1OA4f5RvFKZosExbBHhE6I0Hbzgo3vVnOx3BsMZAL6fzHFB0Ro1lYxuDlYadChEdIGAOU7FBqvr7t4kDybxvVK 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: In preparation for large folio numa balancing, make numa_migrate_prep() to take a folio, no functional change intended. Signed-off-by: Kefeng Wang --- mm/huge_memory.c | 2 +- mm/internal.h | 2 +- mm/memory.c | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 53472e34a761..0f93a73115f7 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1556,7 +1556,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf) */ if (node_is_toptier(nid)) last_cpupid = page_cpupid_last(&folio->page); - target_nid = numa_migrate_prep(&folio->page, vma, haddr, nid, &flags); + target_nid = numa_migrate_prep(folio, vma, haddr, nid, &flags); if (target_nid == NUMA_NO_NODE) { folio_put(folio); goto out_map; diff --git a/mm/internal.h b/mm/internal.h index 7a961d12b088..d7916f1e9e98 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -984,7 +984,7 @@ void vunmap_range_noflush(unsigned long start, unsigned long end); void __vunmap_range_noflush(unsigned long start, unsigned long end); -int numa_migrate_prep(struct page *page, struct vm_area_struct *vma, +int numa_migrate_prep(struct folio *folio, struct vm_area_struct *vma, unsigned long addr, int page_nid, int *flags); void free_zone_device_page(struct page *page); diff --git a/mm/memory.c b/mm/memory.c index a05cfb6be36d..93ce8bcbe9d7 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4727,10 +4727,10 @@ static vm_fault_t do_fault(struct vm_fault *vmf) return ret; } -int numa_migrate_prep(struct page *page, struct vm_area_struct *vma, +int numa_migrate_prep(struct folio *folio, struct vm_area_struct *vma, unsigned long addr, int page_nid, int *flags) { - get_page(page); + folio_get(folio); /* Record the current PID acceesing VMA */ vma_set_access_pid_bit(vma); @@ -4741,7 +4741,7 @@ int numa_migrate_prep(struct page *page, struct vm_area_struct *vma, *flags |= TNF_FAULT_LOCAL; } - return mpol_misplaced(page, vma, addr); + return mpol_misplaced(&folio->page, vma, addr); } static vm_fault_t do_numa_page(struct vm_fault *vmf) @@ -4815,8 +4815,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) last_cpupid = (-1 & LAST_CPUPID_MASK); else last_cpupid = page_cpupid_last(&folio->page); - target_nid = numa_migrate_prep(&folio->page, vma, vmf->address, nid, - &flags); + target_nid = numa_migrate_prep(folio, vma, vmf->address, nid, &flags); if (target_nid == NUMA_NO_NODE) { folio_put(folio); goto out_map;