Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp904114pxp; Wed, 16 Mar 2022 20:46:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoeKLpjoHAkPcGMh4+B1iDlp2JsKLioK22JkLVUjh3DPpbTh3g54vYm1I6tT/7GJGU7pQ2 X-Received: by 2002:a63:1913:0:b0:381:ede3:9adc with SMTP id z19-20020a631913000000b00381ede39adcmr2094518pgl.141.1647488773397; Wed, 16 Mar 2022 20:46:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647488773; cv=none; d=google.com; s=arc-20160816; b=B8bulq+xREgh8zwfTmZcFHaboyDWQa6DR2PFB57yOBo7J6WlyXWoynJygLTYmB+AF3 +1lpjf4PPPt5z9uh+rBfZwio5Mea/ZIOd2S2PaQGPlZAHDKtuXosjYFhiFH/05QaJ2q0 F4mayNERIQUlp6gsgW6PorgMbDxE0jCkm59dD5Kdou3tcdgapBfZ+bQGBnxicu9fIt+x ds+g+5wBEcgRqGnbSBQb5p8JB7iyn4GUQTWS+7aJKyHYRjqTLwLsmEclUo9o1lpIDPop NVjpz0NyiNEXWQqpL9b+2QZUNkRkpJ9OcnQZTCtTNqLpb9eYhPfRfszvbKNiSi9U2Pbn ykXw== 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 :message-id:date:subject:cc:to:from; bh=uKOAsrPv3WYo6OMtt4PAkDi68uhVRldk6/t939qniXk=; b=D9fLAfBMHhILMvW8o0Oq0jnDkZ8SG/ft39UQ4oSbkn0K37LDpcgqHu4b6tLC/zRbWj CzEpGaAaSiCGIfGaYzvtQOD/TvF0VS1lMs9C37Yl9klpiWuX0AoCyIxa/ALsjJEs4H5A Gflxc672IpOhFN7JlMf3XAW1ojHQ+AE+faNVqrOcuxmEMgXfaXK7kWV+K/Kn1L0cJ6Ct HHbuFzgpsh3w1dsC43o2xSzJumc5WYT4C0b0r1AwEuGUv/SMH3ESena5yRkPO0u9/Rox BAOhLINo+eCX+6/tLuUbwUiG+ThH1X41o2GalE8/iI/e6Dldq83iNRRlt0+9tK/FimMU oo4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d18-20020a170903231200b00151c2165c7bsi3596596plh.509.2022.03.16.20.46.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 20:46:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A318670870; Wed, 16 Mar 2022 20:37:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344757AbiCOEZs (ORCPT + 99 others); Tue, 15 Mar 2022 00:25:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238573AbiCOEZr (ORCPT ); Tue, 15 Mar 2022 00:25:47 -0400 Received: from spam.unicloud.com (smgmail.unigroup.com.cn [220.194.70.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D71631FCDF for ; Mon, 14 Mar 2022 21:24:33 -0700 (PDT) Received: from eage.unicloud.com ([220.194.70.35]) by spam.unicloud.com with ESMTP id 22F4OAbb021710; Tue, 15 Mar 2022 12:24:10 +0800 (GMT-8) (envelope-from luofei@unicloud.com) Received: from localhost.localdomain (10.10.1.7) by zgys-ex-mb09.Unicloud.com (10.10.0.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.17; Tue, 15 Mar 2022 12:24:09 +0800 From: luofei To: , CC: , , luofei Subject: [PATCH] hugetlbfs: fix description about atomic allocation of vmemmap pages when free huge page Date: Tue, 15 Mar 2022 00:23:55 -0400 Message-ID: <20220315042355.362810-1-luofei@unicloud.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.10.1.7] X-ClientProxiedBy: zgys-ex-mb10.Unicloud.com (10.10.0.6) To zgys-ex-mb09.Unicloud.com (10.10.0.24) X-DNSRBL: X-MAIL: spam.unicloud.com 22F4OAbb021710 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 No matter what context update_and_free_page() is called in, the flag for allocating the vmemmap page is fixed (GFP_KERNEL | __GFP_NORETRY | __GFP_THISNODE), and no atomic allocation is involved, so the description of atomicity here is somewhat inappropriate. and the atomic parameter naming of update_and_free_page() is somewhat misleading. Signed-off-by: luofei --- mm/hugetlb.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f8ca7cca3c1a..239ef82b7897 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1570,8 +1570,8 @@ static void __update_and_free_page(struct hstate *h, struct page *page) /* * As update_and_free_page() can be called under any context, so we cannot - * use GFP_KERNEL to allocate vmemmap pages. However, we can defer the - * actual freeing in a workqueue to prevent from using GFP_ATOMIC to allocate + * use GFP_ATOMIC to allocate vmemmap pages. However, we can defer the + * actual freeing in a workqueue to prevent waits caused by allocating * the vmemmap pages. * * free_hpage_workfn() locklessly retrieves the linked list of pages to be @@ -1617,16 +1617,14 @@ static inline void flush_free_hpage_work(struct hstate *h) } static void update_and_free_page(struct hstate *h, struct page *page, - bool atomic) + bool delay) { - if (!HPageVmemmapOptimized(page) || !atomic) { + if (!HPageVmemmapOptimized(page) || !delay) { __update_and_free_page(h, page); return; } /* - * Defer freeing to avoid using GFP_ATOMIC to allocate vmemmap pages. - * * Only call schedule_work() if hpage_freelist is previously * empty. Otherwise, schedule_work() had been called but the workfn * hasn't retrieved the list yet. -- 2.27.0