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: 142936 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5158327vqi; Thu, 21 Sep 2023 14:48:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9UsdubyswxajUsYZDHZ1hCSAIsGIGNeycj15bzk2UC0V0rWaiy46QC6Cf2K/wermc19D9 X-Received: by 2002:a05:6a00:2d12:b0:690:463a:fa9d with SMTP id fa18-20020a056a002d1200b00690463afa9dmr7320038pfb.22.1695332901508; Thu, 21 Sep 2023 14:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695332901; cv=none; d=google.com; s=arc-20160816; b=p767CSZkbUe/MxHftP0FNUaRulspNU/MTMTh8kWesjSntGsRApBt16pV+c/3dY3xw+ B94LVn7jWuQnEuHtwtW/epd9R5njrhJUsFFSJkGXAX8uoe8IHNgpMRLt5LDv6K4LYGRl zN1bTmBlvzeUvOk4LGATP2wKU/ZY1mWmpDVkdviV7COig655WE/6HJ1oiffpfOMnD/ud 4ouxF1OQPpsvrrKBERHZ8V7vf4Wy33/bhYRtDCGs4A0YB6uPj7P1LzhBshkE6VNhtgHt kQU7XNPYVGDeFUWMQ6P4gEgOw0nkqlaQQBjwVDz9UBhIaT/xP+KYbOD8+JwFL5hzRD39 W5Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=uPXv4KuxwnoLpD+Fz5M9itVod0PMy/6XrloeJ6kolxs=; fh=Je6qNyAM729b1goCtB6PkBk+yQrlQCIjJMRY6BFgKTo=; b=IRhs86K66cKWPttnw6XMfJkrC+2v92aZ/V8ZPaQPyoYq+KzYdBLOILrTtRl0VgpCoA K2ZmyFL+OE4xR+iOauOUJvz29SMu++InHhUwRKsUSde3P0FGJZbxZjkYUOAP3pLRadVL jFiId5dZIHZU1mHA2NnO/kVX+o9jWnffvka6PqGePv/2Epnoimh3cCp1c8pxo/s8bq99 rlG63NHhqHqqIrIFWGSTJq+Y4BOENnN1F3xu+5OAA8sBfkeETIuOel4BrK0jtk8oUauk KLSPa7uhdWhXqE+kmaYKQ2Izjn38lgzvYbtsvBs7K4/73muhmL33KDPTS+VOBf6xnzF5 1EBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id z69-20020a633348000000b00579ab302fd2si2160374pgz.814.2023.09.21.14.48.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 14:48:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 15E6E81BC2CB; Thu, 21 Sep 2023 14:34:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230523AbjIUVeg (ORCPT + 29 others); Thu, 21 Sep 2023 17:34:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232833AbjIUV3n (ORCPT ); Thu, 21 Sep 2023 17:29:43 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18F523C30 for ; Thu, 21 Sep 2023 10:11:53 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 21 Sep 2023 14:34:53 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777685392723138268 X-GMAIL-MSGID: 1777685392723138268 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;