Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7553429rwb; Tue, 15 Nov 2022 14:12:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf4/xbr/FfwWTjb0DqQMzSYSHbJcBcyL99Igx0wPYVLLjSrpvnNzco3DznXzNSkI/Dmp0hV8 X-Received: by 2002:a63:5f44:0:b0:476:dd80:fb29 with SMTP id t65-20020a635f44000000b00476dd80fb29mr1535574pgb.619.1668550369736; Tue, 15 Nov 2022 14:12:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668550369; cv=none; d=google.com; s=arc-20160816; b=Fcguo410amUnAWU5+ZhDtdiPb2cA1hO99OStaDHdYXTUFbvnWbcCVJx1Y2hsxFfea6 fsJW4fmoSHvRfkdvXwk75i6/1hokqHA+I2hwAJH/ZM844feewpC22IIib3xwJQqLtvb+ 0DebVeWHeKJqnY5aEjMuV2Wnx/0ShRZvPun6GQtYsqav5duwpIY6Vx9uTboxvYaZq38Q T8JIdpju5nMWkajlcj/zU0gYtQSAIVXCg6yvWpfXTJHT/T0EXI0IJ047W/kbpqcMvtjA Kctlz99PCkJ5aUZN0RoRH5PbrHBDns3+AuhdTKsjGFM7oM8R6h+t8d9lEG+746TuwasB c63A== 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 :dkim-signature; bh=0C32TPwYA1sxUQ1BprDeGSkpbbMnBeTp3PiSrVMBGtI=; b=0BDbkgaJFwGrJgCa/uCeLBdZCMeNQuBdXHr5W+j1EsI4Jd+saPlrNnFSZ50gzyo5za y7nUNkm/17xn9gHe+T6c2AXwIgDsitmtuw0dFdSS5+dGe6VFAQ/uvhiM4RhZ9msjLjn8 zjspL5avSFA8JXXGbijKIuRhdgyQuZViowYQksPuxURdyk9LH1Oi9wTND49VRTXSP2vr mKEsS67QQ9vZtiXuPHC0Dp/YKrnXdIBd0W3RcNcRPISMbafOldvnvpi7reFZ2Njo8Z3g CgEeB80xN/FUaG4ZiC/YiDdz3bjYfjvFiG8JCkUt7nyvuJVqwzlsOcTMQqnU/NWI9ukK AHZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=SFRBsTfv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x7-20020a170902ec8700b001874910a2c6si15085724plg.286.2022.11.15.14.12.15; Tue, 15 Nov 2022 14:12:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=SFRBsTfv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238771AbiKOVXY (ORCPT + 90 others); Tue, 15 Nov 2022 16:23:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231953AbiKOVWu (ORCPT ); Tue, 15 Nov 2022 16:22:50 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D37626AC9 for ; Tue, 15 Nov 2022 13:22:49 -0800 (PST) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AFKRoLs008998; Tue, 15 Nov 2022 21:22:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2022-7-12; bh=0C32TPwYA1sxUQ1BprDeGSkpbbMnBeTp3PiSrVMBGtI=; b=SFRBsTfvH1LOKYOxqXdl718oidp1tjJfMSH1LtpfTfvfxmtbDgNiq9vLSe4bcCZD+m56 IXYnRszYpuvuNtBVqcw3ZXpkukPITqJimDsmKDEBxlw6JhMDSlUhsbUQR+Jx+bS4XLcG yTZ+2DsRzNFQeXhF++fqIK9rKtY+uy2HnCyG3wHi3SxuEvCglhyZGYTr3PLtj/42MyP1 FQ2UnfPmvSQNt1sPg/oOCTxXJDbHAYLSsSfegi65THFR7Tfn7SwKItIvtnNDICRWdWPb owdeqypV99huuL2iOf8fDtXMGbBztvlQK8jeZQhaefr0Hxvegk+RXRCE9PYol+Dx3VbG Sw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kv3jsjxa1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Nov 2022 21:22:40 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AFK0D1P031734; Tue, 15 Nov 2022 21:22:38 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kt1xcfvnc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Nov 2022 21:22:38 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2AFLMSRo002082; Tue, 15 Nov 2022 21:22:38 GMT Received: from dhcp-10-132-95-73.usdhcp.oraclecorp.com.com (dhcp-10-132-95-73.usdhcp.oraclecorp.com [10.132.95.73]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3kt1xcfvb0-8; Tue, 15 Nov 2022 21:22:38 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, almasrymina@google.com, linmiaohe@huawei.com, hughd@google.com, Sidhartha Kumar Subject: [PATCH mm-unstable 07/10] mm/hugetlb: convert enqueue_huge_page() to folios Date: Tue, 15 Nov 2022 13:22:14 -0800 Message-Id: <20221115212217.19539-8-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221115212217.19539-1-sidhartha.kumar@oracle.com> References: <20221115212217.19539-1-sidhartha.kumar@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-15_08,2022-11-15_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 suspectscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211150146 X-Proofpoint-ORIG-GUID: ok8lAA7QoayIlTeg983FneMaP8FuRyUG X-Proofpoint-GUID: ok8lAA7QoayIlTeg983FneMaP8FuRyUG X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert callers of enqueue_huge_page() to pass in a folio, function is renamed to enqueue_hugetlb_folio(). Signed-off-by: Sidhartha Kumar --- mm/hugetlb.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 7382c162dbcd..ebb98c1af2fb 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1119,17 +1119,17 @@ static bool vma_has_reserves(struct vm_area_struct *vma, long chg) return false; } -static void enqueue_huge_page(struct hstate *h, struct page *page) +static void enqueue_hugetlb_folio(struct hstate *h, struct folio *folio) { - int nid = page_to_nid(page); + int nid = folio_nid(folio); lockdep_assert_held(&hugetlb_lock); - VM_BUG_ON_PAGE(page_count(page), page); + VM_BUG_ON_FOLIO(folio_ref_count(folio), folio); - list_move(&page->lru, &h->hugepage_freelists[nid]); + list_move(&folio->lru, &h->hugepage_freelists[nid]); h->free_huge_pages++; h->free_huge_pages_node[nid]++; - SetHPageFreed(page); + folio_set_hugetlb_freed(folio); } static struct page *dequeue_huge_page_node_exact(struct hstate *h, int nid) @@ -1540,7 +1540,7 @@ static void add_hugetlb_folio(struct hstate *h, struct folio *folio, return; arch_clear_hugepage_flags(&folio->page); - enqueue_huge_page(h, &folio->page); + enqueue_hugetlb_folio(h, folio); } static void __update_and_free_page(struct hstate *h, struct page *page) @@ -1752,7 +1752,7 @@ void free_huge_page(struct page *page) update_and_free_hugetlb_folio(h, folio, true); } else { arch_clear_hugepage_flags(page); - enqueue_huge_page(h, page); + enqueue_hugetlb_folio(h, folio); spin_unlock_irqrestore(&hugetlb_lock, flags); } } @@ -2427,7 +2427,7 @@ static int gather_surplus_pages(struct hstate *h, long delta) if ((--needed) < 0) break; /* Add the page to the hugetlb allocator */ - enqueue_huge_page(h, page); + enqueue_hugetlb_folio(h, page_folio(page)); } free: spin_unlock_irq(&hugetlb_lock); @@ -2793,8 +2793,8 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, * Ok, old_page is still a genuine free hugepage. Remove it from * the freelist and decrease the counters. These will be * incremented again when calling __prep_account_new_huge_page() - * and enqueue_huge_page() for new_page. The counters will remain - * stable since this happens under the lock. + * and enqueue_hugetlb_folio() for new_folio. The counters will + * remain stable since this happens under the lock. */ remove_hugetlb_folio(h, old_folio, false); @@ -2803,7 +2803,7 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, * earlier. It can be directly added to the pool free list. */ __prep_account_new_huge_page(h, nid); - enqueue_huge_page(h, new_page); + enqueue_hugetlb_folio(h, new_folio); /* * Pages have been replaced, we can safely free the old one. -- 2.38.1