Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6644979iob; Wed, 11 May 2022 02:07:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy18Q96z54UBUaY7Tt4/4iCmXhb2SUie98HZCup74zxOlE3wrTjgnNz/MrDeuxZSF00p8ZY X-Received: by 2002:a62:fb0f:0:b0:4f2:6d3f:5ffb with SMTP id x15-20020a62fb0f000000b004f26d3f5ffbmr24030397pfm.55.1652260043512; Wed, 11 May 2022 02:07:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1652260043; cv=pass; d=google.com; s=arc-20160816; b=jvJEkWCQYHvHauKjubfGIB2TPpxf/U/Ep1xwCpjczr01JpGe1ZPK+OT+rZoiKbz1FA B6MdDANT99oB4w7V8DMY7T+fQa8kC7JDyMUS0ooiKX2zQW9fGMtqdTQV/h0OrEbWgHY7 /q5pNLjF46KvHTaEaOT0ZorGiajvYfM9nBWwNJL9RdA5neeVmXJ9ROLANMK22aspWGnr z73uNbdyoY3r/weHXXq8Ws9bivhD4BNCH+0SVCjmVfHoSY6jaBt2Upolz9MNhFEaaaKY 2btlyynHuaysQjDelJfK75RBYpH8K/Ns/NfWjbBMALCv4YdNh0HXJUtpUvk7cGXUJwsq 5prA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature:dkim-signature; bh=nc4SQ/XgQYEyvJmPnV8sY3vNsZoOvUf8GEwSMP0ZIV4=; b=j4Z7dSoJs9mesPvDJTEbcxqSGLFXOOLIn6jqe50Gqlsl7BkXt+PqDupoa8xyssxJzj dMWRC1LbVOYuEXPiC3fC+HnT9TS6noKCm1rS+PZ1bCk2Z94GPJCAbujKPv4xRLcqFGle ORgKTOjaqOnEOBvrOssg8mojMaKA6Wl0HDGyBEBiJIevLVs0av6IYVWU95QE++jc6b4h M04XqBcTHCUk076W4GbDHy6BJQ4nJQEplhkYBHdA6Ij4eipzycLZ07sinCF+LgV4GcKH dWSn66Xwl/sZBBs6sBFjGRScHw+dY9T/lJ+lnU0ICI6SIcLOZt5aXj9yd33BoqMoIuXI AHpQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2021-07-09 header.b=b2863mt9; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="aAzD/cm7"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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 d2-20020a170902cec200b0015d0c53ae0esi2018397plg.491.2022.05.11.02.07.07; Wed, 11 May 2022 02:07:23 -0700 (PDT) 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-2021-07-09 header.b=b2863mt9; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="aAzD/cm7"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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 S234982AbiEJVb1 (ORCPT + 99 others); Tue, 10 May 2022 17:31:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234850AbiEJVaw (ORCPT ); Tue, 10 May 2022 17:30:52 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5501C8CB1E; Tue, 10 May 2022 14:30:50 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24AIHHJf007656; Tue, 10 May 2022 21:30:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=nc4SQ/XgQYEyvJmPnV8sY3vNsZoOvUf8GEwSMP0ZIV4=; b=b2863mt9TvNKBzJKXQB1M+1agveqQHR10DxBeCl6STpzlTSC1VeDqna7AWCPqcs/JG2b RzXTTeGTgg2wB1z3jzrudY8fv4XfRpsWypVXx4w4wRa+Kaa5xQA/38Inc/5OBhP3jhZt dYvbdHDQ12YAjT36QJwm4qz+f6/pTGC1i0G7hec7K2G8GGz8gJXNNk/7FnVCJ/lXQSPg jBdYq3w/oPa5eM4oSfMVvYHFpQxaD6tGOS1ozdIzKHCMqXxMLoPuU31isaQNd2waq6UM oltQKS34xRt+/FazpiH4HHoGcxNbWTkMZa4Jhd34BaubBKtAXxtVNizZLvg1RBB0kRst 4Q== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3fwgn9qqdc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 May 2022 21:30:34 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24ALFdK4023329; Tue, 10 May 2022 21:30:33 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2170.outbound.protection.outlook.com [104.47.73.170]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3fwf73jfan-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 May 2022 21:30:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QlaIbFu4wXXAhRZ9PjFJcXFXh445DMRZ4bRAMCHzEgDCeoia2yuYmVbDJ5b6BCzh76IrY/O6m9z9+Ka+BnqF3CW5CkFUyQZD0OkXiKJeaxXiYYMyi13wzKmdRqo227jgVEnsTYTC5s3nXhRONd2AarVevDjAntTxkg0nI+4oTjOOuRuPgN86BZHfOI5pF03OkBl9yseqdRaeuY1Z0k9gsjvTm6vkWBKYxLWBiVq1mLwf1TcI26NWISW0ZZS1zRnL2HwBeEQlEpguun7yDHL78vNhHUi4G/X/riKNhD0F2vSF7meuNNOAJPuYlA0yMo0TBstRE4EkgSsff+/u7UqwDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nc4SQ/XgQYEyvJmPnV8sY3vNsZoOvUf8GEwSMP0ZIV4=; b=N0dIaclCVsfa+tNUfBwJl2A8OOBJ+kWd+64I60kmjVY72YEiwLU2NkQ0/6UNpFGbes4PC4gLblzr8/uAIBZWFeWnUtcyyvM0mUPguUIv34ias1ft7YjnyFxrH7mZxTtqZTnM7sdtpd4trrIWwE8ori/xYr2xZBMu2Oq32YpOdXXjxN3k5u1kRYCJWp55w7ATbFIgYa/bz3Y6KURd1lAPVELrBNAIoAF6bu2JHMmckYsUmjl9lydf6Z11rrJJShZHMUWpZthwJSbsNn4l3y3aJedbxBc4+hAbBUEwdkIesJlHG0oapko3nJLnaUgBttYsS6EwMYJebNE9itFGAxRnlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nc4SQ/XgQYEyvJmPnV8sY3vNsZoOvUf8GEwSMP0ZIV4=; b=aAzD/cm7/m73m11citI3Wx1rhtKM2jhiWCfuGxJG3RaF2CeXTunx9YRnLjL3UKMsr27oJVoF+Jrf32w86M9kjNyZ+9VPbAJ3mV1lGD29z0zMzAEszxj7z40dWCqVrEJ0K7tQw6yrJSjvpKGiFNCZJPrHG7aZkRCEjSL3mBjQww0= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by CH0PR10MB5020.namprd10.prod.outlook.com (2603:10b6:610:c0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18; Tue, 10 May 2022 21:30:31 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::9d76:7926:9b76:f461]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::9d76:7926:9b76:f461%9]) with mapi id 15.20.5227.023; Tue, 10 May 2022 21:30:31 +0000 Message-ID: <970166e0-f70e-dd2a-c764-af23a8425f87@oracle.com> Date: Tue, 10 May 2022 14:30:28 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v10 4/4] mm: hugetlb_vmemmap: add hugetlb_optimize_vmemmap sysctl Content-Language: en-US To: Muchun Song , corbet@lwn.net, akpm@linux-foundation.org, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, osalvador@suse.de, david@redhat.com, masahiroy@kernel.org Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, smuchun@gmail.com References: <20220509062703.64249-1-songmuchun@bytedance.com> <20220509062703.64249-5-songmuchun@bytedance.com> From: Mike Kravetz In-Reply-To: <20220509062703.64249-5-songmuchun@bytedance.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MW4PR03CA0280.namprd03.prod.outlook.com (2603:10b6:303:b5::15) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc232cb9-dd1d-40d7-c209-08da32cc4f1a X-MS-TrafficTypeDiagnostic: CH0PR10MB5020:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9TjsxvPwqLApWtPma+AP3H6ZTqtRXJoopKaKguWdlb74mKwMLr2dDbl5WMg+nopujYeaPYrHtzpRQWylDpz3ptimo1M3yUE1cM8tqrR+ixihP8BDEVYqqcONUfsFlHBYsDXHvUnmwH1JBf5OzRidUmT3z+yfqokPOF0ARdrTDLL36oFNPCfvoeuA3B7bGohdbJE4Cv/h87vu+FyVpbTZ3pZNOI/2UMydBm569FNyrVTSiMqXbN8XQmLF2fWlB39bEXnu0Oqrmdu/s/qdk4xFsPVDgfm8lFbhh1fMwzK2pdSTK3begnb3wFJ0PcqnNOm+BhG4KiIlVM65tCfBP+ZRGxuccEc1FIM4Ej92f9GBEMYlsuqqTZ8i2R+ax5nJV+YqZFXFov4OwHYLPPENX6XxpYUzskIMzte2ofUhXXCFjOP2kN+hLuyps7s0xlcm0ftHJfZbSkABl+n2gwX5oc1hZslSV+hEdVe0sBzUZ+2Jh7y8i8lGvaA+ohczaNlArfxsbZew6Za5/RiwpEPRHgsxvb+bXwWG3Qwe8JVoMv+Scbgc/NuJmk9izVYXiYncAys3q5u2oK2sg8qo/9n/XP5rIQ3ZZVPKCsDyWwzVMg0qt+IHaGhWzZcjQ9JyS3XVsaefGbE1+IWbNw1mHXYlj/fSy5l48XVTKRiF6F59kTBvWW9wJB3aE9JFc0PniJWZCns8gwqd7djFoJGHquZzEdVCgpQgEAC7hwu2fODpJEtA6eDT3FtuIgOdQ1hQ3ZaDl5TssrkFSoV7AY+gqOQCM11TSQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4196.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(508600001)(38100700002)(38350700002)(6486002)(7416002)(8936002)(316002)(186003)(8676002)(6506007)(6666004)(36756003)(4326008)(52116002)(2906002)(6512007)(26005)(66556008)(66476007)(53546011)(44832011)(66946007)(31686004)(2616005)(31696002)(5660300002)(86362001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VWd4NWpUcHIrM0pmQ1A3MmVtM0dVQTdINFBZSDF0cGVTdlpIOEtPMXA4NnFp?= =?utf-8?B?cy9leTM4UERmWUdMZ0duWEdQVitSN2wwV0ZYTERiTWRidWRFNTM4NlJYS0o3?= =?utf-8?B?OXF3djhySVJtMkpCK0o1ZWluaTRXWnJDcUFjbGVLZU4wZmZVTnAzdjc1My9J?= =?utf-8?B?elR5WWJxWlBJVG9vU3pVUGZ2c2cvcXJmOFlZS3J6N3o4NG15UUVZUytSaFNN?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VpUXlNWXRadHdhdEtVdVpqeHNVYXcwbm5ydnZJeHhM?= =?utf-8?B?YTVQWk9FYW9tYjB1clVCSUJkS3RlSW1iZ0xVQmFDWUVqdmxnM1BrTXNtZDlO?= =?utf-8?B?bHZtdlVkSVZaRmFhMGFkY0ZIMnc1TTJlbWdQUDBRekpJeTBta3hCY3l3cXQw?= =?utf-8?B?c0tWNXZiL2pseGpqYVpkM2M4aG9aRmVYcXVzdk9kWXVWRUFrMzFIV0s4dklK?= =?utf-8?B?U2JONFlGd2o4TzY5Lyt0RHlKbzJMUHBSZ1dVTnVUY1piZy9TSzUyRGpSTVZR?= =?utf-8?B?aysrVUtnUHEvN2h2UmlYaW9jcE13enFPbDE4YXZ1S2x6TC9LcHU5YlBtRStW?= =?utf-8?Q?vU1S8RI6RTrem+So=3D?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc232cb9-dd1d-40d7-c209-08da32cc4f1a X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2022 21:30:30.9467 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mnug/eBnWyv9g6ViFNKque8Pddp42XT5FDtBAnJuQBKN0+iWvQHmlyGa3lqiDGp1hyl6mrX2c8C0RkHx4iTCIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5020 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.858 definitions=2022-05-10_07:2022-05-09,2022-05-10 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 suspectscore=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205100088 X-Proofpoint-GUID: cg83EAWd4yl2vZ4StujmXSBz591BYKCc X-Proofpoint-ORIG-GUID: cg83EAWd4yl2vZ4StujmXSBz591BYKCc X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 On 5/8/22 23:27, Muchun Song wrote: > diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h > index 029fb7e26504..917112661b5c 100644 > --- a/include/linux/memory_hotplug.h > +++ b/include/linux/memory_hotplug.h > @@ -351,4 +351,13 @@ void arch_remove_linear_mapping(u64 start, u64 size); > extern bool mhp_supports_memmap_on_memory(unsigned long size); > #endif /* CONFIG_MEMORY_HOTPLUG */ > > +#ifdef CONFIG_MHP_MEMMAP_ON_MEMORY > +bool mhp_memmap_on_memory(void); > +#else > +static inline bool mhp_memmap_on_memory(void) > +{ > + return false; > +} > +#endif > + > #endif /* __LINUX_MEMORY_HOTPLUG_H */ > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 8605d7eb7f5c..86158eb9da70 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -1617,6 +1617,9 @@ static DECLARE_WORK(free_hpage_work, free_hpage_workfn); > > static inline void flush_free_hpage_work(struct hstate *h) > { > + if (!hugetlb_optimize_vmemmap_enabled()) > + return; > + Hi Muchun, In v9 I was suggesting that we may be able to eliminate the static_branch_inc/dec from the vmemmap free/alloc paths. With this patch I believe hugetlb_optimize_vmemmap_enabled() is really checking 'has hugetlb vmemmap optimization been enabled' OR 'are there still vmemmap optimized hugetlb pages in the system'. That may be confusing. For this specific routine (flush_free_hpage_work) I do not think we need to worry too much about deciding to call flush_work or not. This is only called via set_max_huge_pages which is not a performance sensitive path. > if (hugetlb_optimize_vmemmap_pages(h)) > flush_work(&free_hpage_work); > } Here is a patch on top of this patch to show my suggestion for removing static_branch_inc/dec from the vmemmap free/alloc paths. It seems simpler to me, and hugetlb_optimize_vmemmap_enabled would only return true if hugetlb vmemmap optimization is currently enabled. I am not insisting that static_branch_inc/dec be eliminated. It may not even work. I have not tested. What do you think? diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index fc4f710e9820..2f80751b7c3a 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -86,7 +87,7 @@ void flush_dcache_page(struct page *page) * is reused (more details can refer to the comments above * page_fixed_fake_head()). */ - if (hugetlb_optimize_vmemmap_enabled() && PageHuge(page)) + if (PageHuge(page) && HPageVmemmapOptimized(compound_head(page))) page = compound_head(page); if (test_bit(PG_dcache_clean, &page->flags)) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 86158eb9da70..8605d7eb7f5c 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1617,9 +1617,6 @@ static DECLARE_WORK(free_hpage_work, free_hpage_workfn); static inline void flush_free_hpage_work(struct hstate *h) { - if (!hugetlb_optimize_vmemmap_enabled()) - return; - if (hugetlb_optimize_vmemmap_pages(h)) flush_work(&free_hpage_work); } diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c index fcd9f7872064..8e0890a505b3 100644 --- a/mm/hugetlb_vmemmap.c +++ b/mm/hugetlb_vmemmap.c @@ -41,9 +41,9 @@ static void vmemmap_optimize_mode_switch(enum vmemmap_optimize_mode to) return; if (to == VMEMMAP_OPTIMIZE_OFF) - static_branch_dec(&hugetlb_optimize_vmemmap_key); + static_branch_disable(&hugetlb_optimize_vmemmap_key); else - static_branch_inc(&hugetlb_optimize_vmemmap_key); + static_branch_enable(&hugetlb_optimize_vmemmap_key); WRITE_ONCE(vmemmap_optimize_mode, to); } @@ -91,7 +91,6 @@ int hugetlb_vmemmap_alloc(struct hstate *h, struct page *head) GFP_KERNEL | __GFP_NORETRY | __GFP_THISNODE); if (!ret) { ClearHPageVmemmapOptimized(head); - static_branch_dec(&hugetlb_optimize_vmemmap_key); } return ret; @@ -102,14 +101,10 @@ void hugetlb_vmemmap_free(struct hstate *h, struct page *head) unsigned long vmemmap_addr = (unsigned long)head; unsigned long vmemmap_end, vmemmap_reuse, vmemmap_pages; - vmemmap_pages = hugetlb_optimize_vmemmap_pages(h); - if (!vmemmap_pages) - return; - - if (READ_ONCE(vmemmap_optimize_mode) == VMEMMAP_OPTIMIZE_OFF) + if (!hugetlb_optimize_vmemmap_enabled()) return; - static_branch_inc(&hugetlb_optimize_vmemmap_key); + vmemmap_pages = hugetlb_optimize_vmemmap_pages(h); vmemmap_addr += RESERVE_VMEMMAP_SIZE; vmemmap_end = vmemmap_addr + (vmemmap_pages << PAGE_SHIFT); @@ -120,9 +115,7 @@ void hugetlb_vmemmap_free(struct hstate *h, struct page *head) * to the page which @vmemmap_reuse is mapped to, then free the pages * which the range [@vmemmap_addr, @vmemmap_end] is mapped to. */ - if (vmemmap_remap_free(vmemmap_addr, vmemmap_end, vmemmap_reuse)) - static_branch_dec(&hugetlb_optimize_vmemmap_key); - else + if (!vmemmap_remap_free(vmemmap_addr, vmemmap_end, vmemmap_reuse)) SetHPageVmemmapOptimized(head); } -- Mike Kravetz