From patchwork Tue Feb 9 13:38:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 12078181 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.8 required=3.0 tests=BAYES_00, 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 3EF35C433E0 for ; Tue, 9 Feb 2021 13:39:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B9DC464DF0 for ; Tue, 9 Feb 2021 13:39:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B9DC464DF0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 590576B0071; Tue, 9 Feb 2021 08:39:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 519D96B0072; Tue, 9 Feb 2021 08:39:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B79B6B0073; Tue, 9 Feb 2021 08:39:04 -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 1E5C86B0071 for ; Tue, 9 Feb 2021 08:39:04 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E1F0D180275BA for ; Tue, 9 Feb 2021 13:39:03 +0000 (UTC) X-FDA: 77798835366.30.rake49_4503fbf27607 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id B9294180909F2 for ; Tue, 9 Feb 2021 13:39:03 +0000 (UTC) X-HE-Tag: rake49_4503fbf27607 X-Filterd-Recvd-Size: 2213 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Tue, 9 Feb 2021 13:39:03 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 50111AFF6; Tue, 9 Feb 2021 13:39:02 +0000 (UTC) From: Oscar Salvador To: Andrew Morton Cc: David Hildenbrand , Michal Hocko , VlastimilBabkavbabka@suse.cz, pasha.tatashin@soleen.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Anshuman Khandual , Oscar Salvador Subject: [PATCH v2 4/7] mm,memory_hotplug: Enforce struct page size to be multiple of PMD Date: Tue, 9 Feb 2021 14:38:51 +0100 Message-Id: <20210209133854.17399-5-osalvador@suse.de> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20210209133854.17399-1-osalvador@suse.de> References: <20210209133854.17399-1-osalvador@suse.de> 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: When struct page's size is not multiple of PMD, these do not get fully populated when adding sections, hence two sections will intersect the same the PMD. This goes against the vmemmap-per-device premise, so reject it if that is the case. Signed-off-by: Oscar Salvador --- mm/memory_hotplug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 95695483a622..d3fb036d33fd 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -57,10 +57,11 @@ static __meminit int memmap_on_memory_store(const char *val, const struct kernel_param *kp) { /* - * Fail silently in case we cannot enable it due to platform constraints. + * Fail silently in case we cannot enable it due to system constraints. * User can always check whether it is enabled or not via /sys/module. */ - if (!IS_ENABLED(CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE)) + if (!IS_ENABLED(CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE) || + (PMD_SIZE % sizeof(struct page))) return 0; return param_set_bool(val, kp);