From patchwork Mon Sep 18 10:32:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13389377 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 ED960CD37B0 for ; Mon, 18 Sep 2023 10:33:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8FA9D6B02D8; Mon, 18 Sep 2023 06:33:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8823D6B02D9; Mon, 18 Sep 2023 06:33:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74A086B02DA; Mon, 18 Sep 2023 06:33:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 636FF6B02D8 for ; Mon, 18 Sep 2023 06:33:11 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 39285C0D0F for ; Mon, 18 Sep 2023 10:33:11 +0000 (UTC) X-FDA: 81249355782.14.32961AC Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf28.hostedemail.com (Postfix) with ESMTP id 4F639C000C for ; Mon, 18 Sep 2023 10:33:07 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 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=1695033189; 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=xzBNWzs4QslYgQE6UPXgY6Lc++vpLEbqpWbKW/jYig0=; b=yvI/gLov59my576d8oHHt+XPexM3Ox2iTYvXKjtAzvnQWSFes26cMW+btQcEbyVxUDJFt4 /TDbWyy3R1dYSjC3DE2TW+oob2bX0L39cFK/VfAsF97MmjjMlA6mRY1+GFQ6UCbYEaZG55 C1bxMci3bidL+KnQcYEYZqpVM+EAPO0= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 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=1695033189; a=rsa-sha256; cv=none; b=N6Ca+GaD7y9jFfZ9688iouR8nLS2YJ2gALfH0WrazswpalKNYSjnckRMPEmnnpR1V6CW5u Y0sg7bFurnbHEJyTRePU7zlDFSeVdzA21X/V6nfZYRx5tVzKJiluTAa02CFO/NR++o2Xol egjYBYZ3OVyse/pG9uUt0H4nLs4BZAY= Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rq1KJ5QCjz15NQJ; Mon, 18 Sep 2023 18:30:44 +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; Mon, 18 Sep 2023 18:32:47 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Mike Kravetz , , Kefeng Wang Subject: [PATCH 3/6] mm: memory: make numa_migrate_prep() to take a folio Date: Mon, 18 Sep 2023 18:32:10 +0800 Message-ID: <20230918103213.4166210-4-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230918103213.4166210-1-wangkefeng.wang@huawei.com> References: <20230918103213.4166210-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 4F639C000C X-Rspam-User: X-Stat-Signature: usk3et1x1utc4j1tfy3mizxjodtcpsp9 X-Rspamd-Server: rspam01 X-HE-Tag: 1695033187-965351 X-HE-Meta: U2FsdGVkX19cMBSk70Lpsm6Fbco3DYbD9oFNw4SmqzxU8TascCOgfrjW5JdyZ/Ldd04KuTl9IzC135tP5lPidbwkW8/spyStWEtaL2khra9TlGN7e4yu/Y7wCl1VHUHU2T8Invd/4+rvjtbSBwVNZVEXZncgREIo65zkSWSNAtCTiMkGfIAd4w6LssjLuV9kQBGVagWf5Upppy68zYdsfSOj3AxbYb1BQCWz9pk3QnPfMbaO1UT2KZQtL3aztO+dZAABDVaSdvYOuxq5TbTU8hsNyvAWslatP/EDS+BWSp1voKGMLq7p1Q7C2y5LVM6YkwnarU1p/9MKd6jbfBvV2ftLDDLlTFp+UhR1FPKsyGd1UsopQV5KRVEIEmvXF3YQZthPnE5ryrVI9/XL3eZGhq7sdSLQAzVPS8tN5ZRdiEnxK0KYCd2A5mMEYt4hQ5bFe4r9t25MRqCxGWdNo2wv6Bf0q4uKYIj+cKua4Oq1lOOdc+CRIKXhjiZa4WbEw6iGPsHHTTAj7Bu60ZRW+N2zgqXFjA2dWhRpbnGPIHQjE0py5kS6SrhHdfxDOx2JqYGXgfJJ3I8vDwjvXqNXXaxwzqWWRZ2D+su/lFhzBHddXVjok1yAYw+atfWJp4Ik8FarcIrsX03458lqFkWIcpL5sAYnmJys1LwjP5azJsHFgU7Gv05zbHUKAjIz4Cq8JYIBvVZ7l8+eVx6hs5iL8g+r31iP6WiK6fS15BaGpId+ndz1mFMjsq8IS7SFcwT75jgSnMBBVEExDCWv19ClLKE5z7ZETl2tpU/gmNbUgVAoeSwVOaqUhEE3FSiCtVemMRfEfXpvPutPRMxmFcjZe2U9Ic+9yiXHRDyvbPPKVXbbOPs5d0076tPqWCUmjz/8P6dbkF45StGdJ+u3AnbfTI2thbv63HRI/wiT7vVMJTkKkuBauT8aYjmnANqcWF/OzO5xvUTHv9gBbxz+nMFIOVd Zjr3GHiZ qgxxUejm/FdTS4sI8T5u+PHr7N0EY2YfG/bOJ+QKJaAVn6SW0Lpm4CIwnqztDIo264uPxlOXLFWiPksSQWpBRWcMDIVAxUmO5o5weAmSm3E+RUoz//RFyHh6bhAsRAd0aanY74kc+uo8EJyTI46mRaGm+9MlJWtI74lspaNws81F+ovwaXUw3TrD7Wp+gPp4cRdPI 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 | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 0da653080d8c..3e34a48fbdd8 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(page_nid)) last_cpupid = page_cpupid_last(page); - target_nid = numa_migrate_prep(page, vma, haddr, page_nid, + target_nid = numa_migrate_prep(page_folio(page), vma, haddr, page_nid, &flags); if (target_nid == NUMA_NO_NODE) { diff --git a/mm/internal.h b/mm/internal.h index 8c90e966e9f8..f30b81f365c1 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -926,7 +926,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 a04c90604c73..ce7d9d9eddc4 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4717,10 +4717,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); @@ -4731,7 +4731,7 @@ int numa_migrate_prep(struct page *page, struct vm_area_struct *vma, *flags |= TNF_FAULT_LOCAL; } - return mpol_misplaced(page_folio(page), vma, addr); + return mpol_misplaced(folio, vma, addr); } static vm_fault_t do_numa_page(struct vm_fault *vmf) @@ -4805,8 +4805,8 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) last_cpupid = (-1 & LAST_CPUPID_MASK); else last_cpupid = page_cpupid_last(page); - target_nid = numa_migrate_prep(page, vma, vmf->address, page_nid, - &flags); + target_nid = numa_migrate_prep(page_folio(page), vma, vmf->address, + page_nid, &flags); if (target_nid == NUMA_NO_NODE) { put_page(page); goto out_map;