Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1255591lqh; Mon, 6 May 2024 01:48:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXxicvyzR2UaXByoVjTeUqoO7CpC6i7GKgTdiMY8eOz6LJrH5aMA02DlyedBSD4pgb4yeV4OigOtQwlVfAxUFP5kzw/dFlUzHfO9TvQqw== X-Google-Smtp-Source: AGHT+IF8gJJTCfTEicQ2f5GXdwnmvM+TuczXMd5M1TImg01fKk2kWuEHcVF/U9suBa1ensH8zVKq X-Received: by 2002:a50:c047:0:b0:572:7b08:d497 with SMTP id u7-20020a50c047000000b005727b08d497mr5815962edd.17.1714985283172; Mon, 06 May 2024 01:48:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714985283; cv=pass; d=google.com; s=arc-20160816; b=0Ag1WqtcZaers16rQ9bzcCtK0KdOX8lgc1cpd4tH5g1PeEjqgjsymXqz8T5wZVGQVu YDp9m3c8d/REyzHzNFe/XPChmc400/Zoa/DTXuVfCU0Q/5Uic15JeOa6oeF7slk1dQl1 8VIa34IMIMNmG1BH+L1rGrcMXf268AgVkPS53OzmhzZpcQ8X6ujcEsOFcVdDMAwLdSKT mupeKb1kumsW5yWLEuDZuw6k/vvLa3KNUPVSAkItAvfPf5DOAccHETL16QRkpjlVrTNN LtNCICq4tPPSJjVSPAvqRFePfZJwd1Kq/IBOYfJmVhimAoqu8yPy/oAo4x+U6D00M4+T +oUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=e+vn44n5PSOyoo2A5G9/u00K/6MLWmZWHwZJ5wJKuyA=; fh=QbwS3auWn4deePzqcQEgPh0o+FZG4BOPGyVFHXP9ySY=; b=p/Y2EEbaHk2k67yR3Qf+c7gk8EnR1A2lljZujdkew1y+8uU8NbMA0K9NUfP4Stu3Uu 0/dW8Kp3rJbqU9mluG6/XlaIfIW4x6/+JnOfJrA7y+9ti1H41RCmPzJtBpRdHYW2dO4r NZaPByhpumEk3iUegBjucqX97IywM0T6BNjQKp5ppQlwP6yLRTAOizKGH+9r4b7vVO4r vmW0CvbnQ9KACNrn/BhF1FF5mzvoBUNKitn2BkzcPr43jKpczs6+yaBfT5gv0J+8H290 z54FkTN7vbgDyCTZWnxkQbcjhnqkQTPZ2efLxNitFgPdrlZkRE3pFk6+SllpsrI3qCZu 5AdQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=NBO3RhgZ; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-169521-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169521-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u16-20020a509510000000b0057302008be9si701028eda.575.2024.05.06.01.48.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 01:48:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169521-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=NBO3RhgZ; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-169521-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169521-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7CF6D1F22DDD for ; Mon, 6 May 2024 08:47:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE7B114265A; Mon, 6 May 2024 08:46:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="NBO3RhgZ" Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7B401422AE for ; Mon, 6 May 2024 08:46:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714985214; cv=none; b=flEACpr2X5qbLosewBCoFnVo4osto06PDDISIekXwDS8oBvTlemhqQQn3QhHNxM8LaELgD67deZ1nO5uSCydEuYYzCrId4u4TBTg1D17eo8jXt8soU3f2f0X+Bf07Ca8rG55Owg+2lCT3xUwKLYsQLz1fiusyWvb8jH1atGsFtg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714985214; c=relaxed/simple; bh=KSE8PzIjqSwH61R6iAt633ULjGLPnWmzNqBKlZgUjh8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JRoUC1d4rjpoV0PHI61nt2B4rKmP/q1Nzq/AzbssyI4to3byWoyjI8icBhjnkv6YE9xRU5iG+Md6vGN97HckneTU8bzRmsxPwwih+P2cPB4lMRB017blPzA/vhWnkMciavHEFRPZTuNGrG/uh3KlJzMEpov5oTd1jblBDtYD3mM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=NBO3RhgZ; arc=none smtp.client-ip=115.124.30.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1714985209; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=e+vn44n5PSOyoo2A5G9/u00K/6MLWmZWHwZJ5wJKuyA=; b=NBO3RhgZtwwSxO/fhmCPakT/RPYawsIkyGEhX/KM/GFSgkZswZ3uv7xtXtsWEjhKjq1ki+1ki6grE2SeMeRsFfTW1EjUkG7ZGXFdA6g5LzJ8DHdqkDKVbmysXw2pT4vMWdTvre0GNyO0EeVMIyXjt0OUwxMMLI/9lNGtHngDTz8= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R721e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037067111;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0W5wQIAj_1714985206; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W5wQIAj_1714985206) by smtp.aliyun-inc.com; Mon, 06 May 2024 16:46:47 +0800 From: Baolin Wang To: akpm@linux-foundation.org, hughd@google.com Cc: willy@infradead.org, david@redhat.com, ioworker0@gmail.com, wangkefeng.wang@huawei.com, ying.huang@intel.com, 21cnbao@gmail.com, ryan.roberts@arm.com, shy828301@gmail.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/8] mm: shmem: add an 'order' parameter for shmem_alloc_hugefolio() Date: Mon, 6 May 2024 16:46:27 +0800 Message-Id: <1484509ad5a9751b449e01fb695c4e7634be14bf.1714978902.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a new parameter to specify the huge page order for shmem_alloc_hugefolio(), as a preparation to supoort mTHP. Signed-off-by: Baolin Wang --- mm/shmem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index fa2a0ed97507..e4483c4596a8 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1604,14 +1604,14 @@ static gfp_t limit_gfp_mask(gfp_t huge_gfp, gfp_t limit_gfp) } static struct folio *shmem_alloc_hugefolio(gfp_t gfp, - struct shmem_inode_info *info, pgoff_t index) + struct shmem_inode_info *info, pgoff_t index, int order) { struct mempolicy *mpol; pgoff_t ilx; struct page *page; - mpol = shmem_get_pgoff_policy(info, index, HPAGE_PMD_ORDER, &ilx); - page = alloc_pages_mpol(gfp, HPAGE_PMD_ORDER, mpol, ilx, numa_node_id()); + mpol = shmem_get_pgoff_policy(info, index, order, &ilx); + page = alloc_pages_mpol(gfp, order, mpol, ilx, numa_node_id()); mpol_cond_put(mpol); return page_rmappable_folio(page); @@ -1660,7 +1660,7 @@ static struct folio *shmem_alloc_and_add_folio(gfp_t gfp, index + HPAGE_PMD_NR - 1, XA_PRESENT)) return ERR_PTR(-E2BIG); - folio = shmem_alloc_hugefolio(gfp, info, index); + folio = shmem_alloc_hugefolio(gfp, info, index, HPAGE_PMD_ORDER); if (!folio) count_vm_event(THP_FILE_FALLBACK); } else { -- 2.39.3