Message ID | 20201113105952.11638-21-songmuchun@bytedance.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=2mdj=ET=kvack.org=owner-linux-mm@kernel.org> 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 09A29697 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 13 Nov 2020 11:04:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B116B22258 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 13 Nov 2020 11:04:48 +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="acPhX2RT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B116B22258 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 C73A06B00C2; Fri, 13 Nov 2020 06:04:47 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C23DE6B00D0; Fri, 13 Nov 2020 06:04:47 -0500 (EST) 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 B12EB6B00D1; Fri, 13 Nov 2020 06:04:47 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0242.hostedemail.com [216.40.44.242]) by kanga.kvack.org (Postfix) with ESMTP id 7B2CA6B00C2 for <linux-mm@kvack.org>; Fri, 13 Nov 2020 06:04:47 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2B02A3629 for <linux-mm@kvack.org>; Fri, 13 Nov 2020 11:04:47 +0000 (UTC) X-FDA: 77479112214.07.chess45_05074482730e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 0F1EB1803F9A9 for <linux-mm@kvack.org>; Fri, 13 Nov 2020 11:04:47 +0000 (UTC) X-Spam-Summary: 1,0,0,39377d28e8795293,d41d8cd98f00b204,songmuchun@bytedance.com,,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1539:1568:1711:1714:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3866:3867:4321:4385:5007:6261:6642:6653:6737:6738:10004:11026:11473:11658:11914:12043:12048:12297:12438:12517:12519:12555:12895:13069:13161:13229:13255:13311:13357:13894:14181:14384:14394:14721:21080:21444:21451:21627:21990:30054,0,RBL:209.85.215.196:@bytedance.com:.lbl8.mailshell.net-66.100.201.201 62.2.0.100;04yfigj881nnfre419xgah6hottznypupcnje1ihtzdjfgxmnfr17gnbh73xaqc.pgo3uyeygp7td6absyg8e5f1r7xafeao4fn3z7kfcchqdnu7ayqnokz9ibwk71r.h-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:68,LUA_SUMMARY:none X-HE-Tag: chess45_05074482730e X-Filterd-Recvd-Size: 4352 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by imf45.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Fri, 13 Nov 2020 11:04:46 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id h16so2738104pgb.7 for <linux-mm@kvack.org>; Fri, 13 Nov 2020 03:04:46 -0800 (PST) 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=9fcYda0AgPV/WnXKlnMuFEs34xJLysA9FVwvOk3sXIs=; b=acPhX2RT/KAG0d/biBqn+RStXr042kHnAgVWmRzsh8fygXJWhjB4LGnM3ArK78IYHy 05M1F8hixARWaE1jYAwk1yTcqe4rYbkfaAHkyKyIi4+8+9KuXuglgShz7W6hkk/X9HE1 N2n5uQS2/wDQuZFTzGZ2NDZiK2mDbfUba6OJJMr87S9/fgyc80MoT7cLUTQ0vFQyAdgF du7NuXu0ZzcYLYPUkUpImZuusIrbVD8hT0F5R4Tcs5ycO3EjK1rKcs04htAn854HEBTd hZoDX34VvtIBK69tAyNUPPlre/Wvo5RGsq3oAxvzDW7F326FTW5eb4uxR5bfOdkM8Pbw Eazg== 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=9fcYda0AgPV/WnXKlnMuFEs34xJLysA9FVwvOk3sXIs=; b=RyoXMcQZ5FeFRs/VfrxFZDjoozf9nvXNBS77adD3KSX36gA3Lg9VrshdZJSlkrqGlT D2qqNpF9K+5wjX6f2239EBSRKJiJbh2ozWZSpkfYUW6+i0wCEE1LjvcgR5bywr7QNFfB gNxJxO7entg20HLHgMILgdW/P7fqAcUeXeoHNW4XhzPr6Z1EN2jqCnWxeZPFWp84g2fK U0w/emrgDBGImwb6V53a7HiUZUCmneoz3/KxSa9HZ9hKimq/qrC4kR7w8HSDvj9k7dxT f+VJmfeIen+jxId07z3qQXFQtUYhjbYvkoZub2jJBAf/JJtokHY4+KPPVyI+uejBna7k JFLA== X-Gm-Message-State: AOAM533CFKdG9c4wPM5U2xeeE/z5cW0bfSmIy8szJ58jYDR0NWO5rxnF BZUJFlVU7G6z7wzN2/afP2CZVg== X-Google-Smtp-Source: ABdhPJy3y4l2jKKhlBarikLuHDHXd6EaPh5lhfhf6nys027+oDsqWvIQDzCElVYorC4v+mz0uMOCFA== X-Received: by 2002:a17:90a:d184:: with SMTP id fu4mr1106379pjb.173.1605265485688; Fri, 13 Nov 2020 03:04:45 -0800 (PST) Received: from localhost.localdomain ([61.120.150.78]) by smtp.gmail.com with ESMTPSA id f1sm8909959pfc.56.2020.11.13.03.04.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Nov 2020 03:04:45 -0800 (PST) From: Muchun Song <songmuchun@bytedance.com> 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, willy@infradead.org, osalvador@suse.de, mhocko@suse.com Cc: duanxiongchun@bytedance.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Muchun Song <songmuchun@bytedance.com> Subject: [PATCH v4 20/21] mm/hugetlb: Add BUILD_BUG_ON to catch invalid usage of tail struct page Date: Fri, 13 Nov 2020 18:59:51 +0800 Message-Id: <20201113105952.11638-21-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20201113105952.11638-1-songmuchun@bytedance.com> References: <20201113105952.11638-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: <linux-mm.kvack.org> |
Series |
Free some vmemmap pages of hugetlb page
|
expand
|
diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c index 5c00826a98b3..f67aec6e3bb1 100644 --- a/mm/hugetlb_vmemmap.c +++ b/mm/hugetlb_vmemmap.c @@ -717,6 +717,9 @@ static int __init vmemmap_ptlock_init(void) { int nid; + BUILD_BUG_ON(NR_USED_SUBPAGE >= + RESERVE_VMEMMAP_SIZE / sizeof(struct page)); + if (!hugepages_supported()) return 0;
There are only `RESERVE_VMEMMAP_SIZE / sizeof(struct page)` struct pages can be used when CONFIG_HUGETLB_PAGE_FREE_VMEMMAP, so add a BUILD_BUG_ON to catch this invalid usage of tail struct page. Signed-off-by: Muchun Song <songmuchun@bytedance.com> --- mm/hugetlb_vmemmap.c | 3 +++ 1 file changed, 3 insertions(+)