From patchwork Tue Sep 15 12:59:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 11776497 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8735D14B7 for ; Tue, 15 Sep 2020 13:01:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 407B020829 for ; Tue, 15 Sep 2020 13:01:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bytedance-com.20150623.gappssmtp.com header.i=@bytedance-com.20150623.gappssmtp.com header.b="rKQ26Puo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 407B020829 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0449990003C; Tue, 15 Sep 2020 09:01:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F107590003A; Tue, 15 Sep 2020 09:01:39 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8BAC90003C; Tue, 15 Sep 2020 09:01:39 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0173.hostedemail.com [216.40.44.173]) by kanga.kvack.org (Postfix) with ESMTP id B82C790003A for ; Tue, 15 Sep 2020 09:01:39 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3352645CD for ; Tue, 15 Sep 2020 13:01:38 +0000 (UTC) X-FDA: 77265307476.20.steel66_2106ae727111 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 662BD180C1487 for ; Tue, 15 Sep 2020 13:01:30 +0000 (UTC) X-Spam-Summary: 1,0,0,b4cce527e70bde09,d41d8cd98f00b204,songmuchun@bytedance.com,,RULES_HIT:41:355:379:541:800:960:965:966:973:988:989:1260:1311:1314:1345:1359:1431:1437:1515:1534:1540:1568:1711:1714:1730:1747:1777:1792:1981:2194:2196:2199:2200:2393:2559:2562:3138:3139:3140:3141:3142:3865:3867:4385:4390:4395:5007:6120:6261:6653:6737:6738:10004:11026:11473:11657:11658:11914:12043:12048:12296:12297:12438:12517:12519:12555:12895:13069:13311:13357:13894:14096:14181:14384:14721:21080:21444:21451:21627:21990:30054,0,RBL:209.85.210.194:@bytedance.com:.lbl8.mailshell.net-62.2.0.100 66.100.201.201;04yrmm83k7iwzodgy9jou8ekfeb6uocgz4jbk73yyhhiashbfummdfh7xwwutw4.xn63xgm4jpo39j4ny4kwo54usmu699r6zc1jteuuzk7gh81fz9mt9rh7gs9xxwj.k-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:28,LUA_SUMMARY:none X-HE-Tag: steel66_2106ae727111 X-Filterd-Recvd-Size: 4397 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Tue, 15 Sep 2020 13:01:18 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id l126so1893499pfd.5 for ; Tue, 15 Sep 2020 06:01:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5ZrW0owKm5Gu/md3j3csp/5vC7YMmkDgEblXZgaxGvk=; b=rKQ26Puop/3DC0nrZnzSaunkjQvxjCcWAFcRgsiFlS5oDPySzDrGYBOFscTRKZ4YlM HaZkWdGc00lfINkpTlQMky/65NALAje0ARqIxEgH8YHLW7y7qMzJoRrKyRVuYSbP/nf+ XH+MsNGqG3VKJTq7YO2bdVXuP1ZxSlHHxR7GFhsEItGdJemBjAS1la5HsrJ/eZvvGPT+ uMOO4JsqFuKv6FtCD0c5rWItP6VMCkdTcNiPG/pDcH2K7Gwv8fleIR1REqxGU8d0hvRN zVLvYD5ThV6VB1WeSJIJx6TUdr4YJgoVoF3sNLFaVYR08jBnTX5fXC9FmrD2eOTInsFw GDrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5ZrW0owKm5Gu/md3j3csp/5vC7YMmkDgEblXZgaxGvk=; b=rKFox2p0vlpRiqB4IzTFwDu2CMZ3InQxKAGKPl//hiGEicNN8BXpXG1sh3v4oZSktL /awSxjFzsm3bmlEOU5ExswWFQ4RgDpe+Af+cAaapEnD5HYk2D86yY/Kv40NPfSdI3lj/ xhiVSNGn1oHN/DvDEqtfPij++kP8WDJjiAmyVTItKSsUaJEHlKxOEGgPnBqkWlmNQG5H gHHm2J8cYdUEjXPimZXHT+F6AvDzLztxvG/6Z89UaNihxBXF9BaaMEEs0Ium83l2Qh/Y RknoJ6tyuZYvKebSqDPWhuBH0VF3TT4eUQLZ8xiLHdUJbNBB7jkRQPHa/sM8ZScRAV88 Zkhw== X-Gm-Message-State: AOAM533OF19Fj3FmP1T4W8JRI/N02HbpvgYn+cchDUACs5YfA4MpMiZg yWyCTJc10euYXYFZsaMqZdyzgA== X-Google-Smtp-Source: ABdhPJw36/tEPEk+vlzhPHIn06m+FQnqNgd2oPnWDmzY+7j8re+39DQktUux3tDDjqBaTAXQu8D/0A== X-Received: by 2002:a63:1226:: with SMTP id h38mr14256662pgl.196.1600174876644; Tue, 15 Sep 2020 06:01:16 -0700 (PDT) Received: from localhost.bytedance.net ([103.136.220.66]) by smtp.gmail.com with ESMTPSA id w185sm14269855pfc.36.2020.09.15.06.01.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2020 06:01:15 -0700 (PDT) From: Muchun Song To: corbet@lwn.net, mike.kravetz@oracle.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, paulmck@kernel.org, mchehab+huawei@kernel.org, pawan.kumar.gupta@linux.intel.com, rdunlap@infradead.org, oneukum@suse.com, anshuman.khandual@arm.com, jroedel@suse.de, almasrymina@google.com, rientjes@google.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Muchun Song Subject: [RFC PATCH 07/24] mm/hugetlb: Add freeing unused vmemmap pages support for x86 Date: Tue, 15 Sep 2020 20:59:30 +0800 Message-Id: <20200915125947.26204-8-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20200915125947.26204-1-songmuchun@bytedance.com> References: <20200915125947.26204-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 662BD180C1487 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On x86_64 architecture, we use hupe page mapping vmemmap area. We should define VMEMMAP_HPAGE_SHIFT to the correct value to support freeing unused vmemmap pages. Signed-off-by: Muchun Song --- arch/x86/include/asm/hugetlb.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h index 1721b1aadeb1..f5e882f999cd 100644 --- a/arch/x86/include/asm/hugetlb.h +++ b/arch/x86/include/asm/hugetlb.h @@ -5,6 +5,11 @@ #include #include +#ifdef CONFIG_HUGETLB_PAGE_FREE_VMEMMAP +#define VMEMMAP_HPAGE_SHIFT PMD_SHIFT +#define arch_vmemmap_support_huge_mapping() boot_cpu_has(X86_FEATURE_PSE) +#endif + #define hugepages_supported() boot_cpu_has(X86_FEATURE_PSE) #endif /* _ASM_X86_HUGETLB_H */