From patchwork Fri Nov 20 06:43:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 11919603 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 8FDEAC63798 for ; Fri, 20 Nov 2020 06:49:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 05D71223AC for ; Fri, 20 Nov 2020 06:49:39 +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="H2aA2xao" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 05D71223AC 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 89BFC6B005C; Fri, 20 Nov 2020 01:49:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 826416B0068; Fri, 20 Nov 2020 01:49:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C6196B0087; Fri, 20 Nov 2020 01:49:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id 2E1416B005C for ; Fri, 20 Nov 2020 01:49:39 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id BEA9E180AD81F for ; Fri, 20 Nov 2020 06:49:38 +0000 (UTC) X-FDA: 77503870836.02.quill55_60140be27349 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 9B2D410097AA0 for ; Fri, 20 Nov 2020 06:49:38 +0000 (UTC) X-HE-Tag: quill55_60140be27349 X-Filterd-Recvd-Size: 4436 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Fri, 20 Nov 2020 06:49:38 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id y7so6915914pfq.11 for ; Thu, 19 Nov 2020 22:49:38 -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=SdvvqKnmPQDzzEKZQavt4aA9vX77aS/RCbk9rPPVeB4=; b=H2aA2xaoiWnwW6nf39Kv1EUsqrKNerzQbrslq/NI7IVdIRJqgVKSNb1QLSqFeexpQM s2W0bOQA2Z64MXFCeBPxIhsqOPs/fle/YtmNMi/7ymQt8cIMHdL2FqrPekNTKBVqwmXJ XFDSPuJ1TaON1L0Hee6XRFlcq2QRhwzojGlwxWgbZiM4xfDN1mM0UzgJia6txEDmnfl6 ZUBSo75B0Qdjne4F2h4rdu0tuC79BS6n+m8abxUxiRMbbYPpGvcpqJKU6sE5stAVk5wM wt29LVkQUPffCEZn/FBagi1xtxYlpnhHFdv4TlqFdBDgiAJFAmz4i2qEBSI/2RAq/K6V ezpw== 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=SdvvqKnmPQDzzEKZQavt4aA9vX77aS/RCbk9rPPVeB4=; b=btMiDLmMki+Y0IdM5WuDzjNnVcC/9bqWrBHVg0uEInb8RBE46vzPL9GfweM1zDt0La ilv6OZ6Ijxjhr1et+PXt929PwgCQeQlZ1klFAUq0800Ri5/IFjOOTo7epDO2rp77nEJU P2OGo9KsrP0ihbmd6VidLk1DAGzC70HCqkKUBwE0IvshtRXAE9wRYXCrNsK6VLgCaluI wcwIWUwu4vo+gQMZRjIFd+GmMvt+9tWKR0HtlR4jYWpnA+EsloYGZCvKp74xjXjeMNNd JULDbZyytPEgpHeMw5RL+wXYkk17/ldl51wUp6rcXGEw322LjyzaYRpSr8GypkmMRUsk GBbw== X-Gm-Message-State: AOAM532Nd6yL4305Y+tyWEZE0JHqAQXMHuoRiI++iu1AtoU6vhihGUB4 IWc32/IoUB3GegkjpwTHHIxelQ== X-Google-Smtp-Source: ABdhPJzHqJGyY5pbu9G4vQoTS2YSYmL0vWhnJb+/ViUAprblRJ1z84SdXKgyNJ2fDva3na3APIqFKg== X-Received: by 2002:a63:1445:: with SMTP id 5mr15580297pgu.357.1605854977294; Thu, 19 Nov 2020 22:49:37 -0800 (PST) Received: from localhost.localdomain ([103.136.221.72]) by smtp.gmail.com with ESMTPSA id 23sm2220278pfx.210.2020.11.19.22.49.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Nov 2020 22:49:36 -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 v5 21/21] mm/hugetlb: Disable freeing vmemmap if struct page size is not power of two Date: Fri, 20 Nov 2020 14:43:25 +0800 Message-Id: <20201120064325.34492-22-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20201120064325.34492-1-songmuchun@bytedance.com> References: <20201120064325.34492-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 unused vmemmap to the buddy system when the size of struct page is a power of two. Signed-off-by: Muchun Song --- mm/hugetlb_vmemmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c index c3b3fc041903..7bb749a3eea2 100644 --- a/mm/hugetlb_vmemmap.c +++ b/mm/hugetlb_vmemmap.c @@ -671,7 +671,8 @@ void __init hugetlb_vmemmap_init(struct hstate *h) unsigned int order = huge_page_order(h); unsigned int vmemmap_pages; - if (hugetlb_free_vmemmap_disabled) { + if (hugetlb_free_vmemmap_disabled || + !is_power_of_2(sizeof(struct page))) { pr_info("disable free vmemmap pages for %s\n", h->name); return; }