From patchwork Tue Nov 24 09:52:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 11927807 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89456C2D0E4 for ; Tue, 24 Nov 2020 09:57:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ED59420857 for ; Tue, 24 Nov 2020 09:57: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="tIraSHcG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED59420857 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 6B5A06B0080; Tue, 24 Nov 2020 04:57:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 68B916B0081; Tue, 24 Nov 2020 04:57:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A20C6B0082; Tue, 24 Nov 2020 04:57:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0174.hostedemail.com [216.40.44.174]) by kanga.kvack.org (Postfix) with ESMTP id 44E0B6B0080 for ; Tue, 24 Nov 2020 04:57:48 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0F095181AEF1F for ; Tue, 24 Nov 2020 09:57:48 +0000 (UTC) X-FDA: 77518860216.19.crime54_400d7b02736d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id D500A1ACEA4 for ; Tue, 24 Nov 2020 09:57:47 +0000 (UTC) X-HE-Tag: crime54_400d7b02736d X-Filterd-Recvd-Size: 4570 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Nov 2020 09:57:47 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id b6so7546997pfp.7 for ; Tue, 24 Nov 2020 01:57: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=wHH3/jV+QgVymFROaAhyfWbEGBmLguB5hGi6rHX+6Xk=; b=tIraSHcGfsyLsDtWBE3f6AbmDLC7hMtycXi3qi3o3exCsJUurK5k90ln0isM5Drjro DB3XS0aPqP3k6MAuAEVkri+xicJsmaoBVJ6XcZdWf8bJSsOSZ+4lKenrLm+w/1Hl8vqf tOk3a9jGCBOgRSLz+QSj9jE2Cn6cwR3NOsMBDXeJjikoBRbZqjJTCH/zd9viZZRoNDeN KbNVk81Mtl72BMRuaz22/mNFA91Rf2fvN2O6zk32JPUzAltYH9HoWnvWrsY96Hb5ULYA mHCgOqrC+bIuwKv1R0RntDu8DmcEb0G2EVW6bSQp02sUOQyIxIFHjEe++uDDOc5ZkbBd YtRA== 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=wHH3/jV+QgVymFROaAhyfWbEGBmLguB5hGi6rHX+6Xk=; b=ZxenYj6ThiV70fa8/NsEhvfft+xgLp2wgRQI4oJW1AdrlZeJXqJ9X4cZVSXfUjVXxT EB2RWTEdVaf99Azte79ky+ijdfWu/rfMDgd/0yNOGAKH1SU6/X+VrWKwqb1EcINECvIT 73N/rsDYiOMjNM3cxidNH/JJJtY3yNhVj/wQfZdNzbueEK5Rtqk/bWmzHp3IOR23KLOv bNIzb1HB1KzxEfd4thHOUZVJuK/u3yUXYK8fE2f2/+nNDSfWS+TY3TLTYClqunCG+XGp E4qqV5nsKqupx83weWUlRqWzutkX4XJBvYKtUGwb3EERXKqJ/qjqGR9yTUhYDrIDdT7Z qy/w== X-Gm-Message-State: AOAM531xKQRGCsBVP0sx+bo+CoBY3U0bfSkMi6yCerx8pHXpDCjDY47C Wg6G+mLtCmuIKPjREfhfYdm09Q== X-Google-Smtp-Source: ABdhPJysdofJSVH3w1/BPgZk3TLFnf6hemKsSPCvyi4+CmocLeKlIa0h4pckqN8WwHQ4tU+2hvxHEQ== X-Received: by 2002:a62:2a81:0:b029:18c:310f:74fe with SMTP id q123-20020a622a810000b029018c310f74femr3356086pfq.50.1606211866326; Tue, 24 Nov 2020 01:57:46 -0800 (PST) Received: from localhost.localdomain ([103.136.220.120]) by smtp.gmail.com with ESMTPSA id t20sm2424562pjg.25.2020.11.24.01.57.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Nov 2020 01:57:45 -0800 (PST) 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, willy@infradead.org, osalvador@suse.de, mhocko@suse.com, song.bao.hua@hisilicon.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 Subject: [PATCH v6 06/16] mm/hugetlb: Disable freeing vmemmap if struct page size is not power of two Date: Tue, 24 Nov 2020 17:52:49 +0800 Message-Id: <20201124095259.58755-7-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20201124095259.58755-1-songmuchun@bytedance.com> References: <20201124095259.58755-1-songmuchun@bytedance.com> MIME-Version: 1.0 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: We only can free the tail vmemmap pages of HugeTLB to the buddy allocator when the size of struct page is a power of two. Signed-off-by: Muchun Song --- mm/hugetlb_vmemmap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c index fad760483e01..fd60cfdf3d40 100644 --- a/mm/hugetlb_vmemmap.c +++ b/mm/hugetlb_vmemmap.c @@ -111,6 +111,11 @@ void __init hugetlb_vmemmap_init(struct hstate *h) unsigned int order = huge_page_order(h); unsigned int vmemmap_pages; + if (!is_power_of_2(sizeof(struct page))) { + pr_info("disable freeing vmemmap pages for %s\n", h->name); + return; + } + vmemmap_pages = ((1 << order) * sizeof(struct page)) >> PAGE_SHIFT; /* * The head page and the first tail page are not to be freed to buddy