From patchwork Wed Dec 5 09:19:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 10713421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 321701057 for ; Wed, 5 Dec 2018 09:19:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22EF52C83A for ; Wed, 5 Dec 2018 09:19:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 178252C847; Wed, 5 Dec 2018 09:19:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7E132C83A for ; Wed, 5 Dec 2018 09:19:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D106F6B7390; Wed, 5 Dec 2018 04:19:21 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C98B66B7391; Wed, 5 Dec 2018 04:19:21 -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 B3A666B7392; Wed, 5 Dec 2018 04:19:21 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by kanga.kvack.org (Postfix) with ESMTP id 6E02A6B7390 for ; Wed, 5 Dec 2018 04:19:21 -0500 (EST) Received: by mail-pl1-f198.google.com with SMTP id m13so14525131pls.15 for ; Wed, 05 Dec 2018 01:19:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=/q0blaq9Plszq/mvWW0OupnapM5OEx6p+kGada6ffx0=; b=sJDCjrBITFopfY6aMwUQqgPtCCprtztaLXWZ0Z6fIdNZONEkcvQYGD1qTipy1qxiH2 nhw9z7LNtLvSUZV1TNHUqdV/NR8b2z4S6ulF45KptWnlmyF6v73lbJtxuChDinNwCs2F YL3L4fLmWskAZFShwce7b7qraZVGig2gMyubO+VN1s3psrDAYL42hPCXaB2gPYaR/+jY 1RCw7GwG4atzyRZtnoCMWasozpbd+AfzLobDPTJZY2pAhD9i8V95KObEpW8FXVJCZdVo fkU4kc7X+d6GUK2aUbvEK3UsUblFpBD1//s11Qb/hy/OalvkWj7PDtUgFH397AzVhdgW Dw7A== X-Gm-Message-State: AA+aEWY5ISma6dzOhXMWQeW8FPXEf1PVX6p4ezCFcm+cLEif3zLHdSg/ P31tpgk3spwzomOZZsAuzw2DPrfO+fTgKqvzzj/3j9QLRHJQ4/LCZKLPVrprd7pd8qbRDiUPFLU D3xdyeuXLyVIn3w5Zcu4xekqUJZMOCNy58Y9hHElcfbl6OaLhhGrhA9N3aoPPv1XSMwHHbzPXEl WNzQzANDHtU6eoQX+eDvIGq9jCUc1hTsHSd95OiIDnUxNJX4j2umLaRMvOz0zC/eX7yqC6uLDaG WEcoGQYfGHBoz7yRtTh8ZXgcfsZIaKqueVT2TF/FDueqBaDhFEv/tbG+E7y3akaMdRDVOwl/f6W urPbyBFUEmz0p27qDyAeWD5HWBHiAMOEM1Ib4Jw60652qTPvlrRB0C0ejBPmgTfaSoP+I3Cep7r L X-Received: by 2002:a63:2a4a:: with SMTP id q71mr19624353pgq.374.1544001561137; Wed, 05 Dec 2018 01:19:21 -0800 (PST) X-Received: by 2002:a63:2a4a:: with SMTP id q71mr19624314pgq.374.1544001560461; Wed, 05 Dec 2018 01:19:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544001560; cv=none; d=google.com; s=arc-20160816; b=dSXpC+cRag3qpbbyQxgI3aWXD3ZaKH0J7FbhNeAtRB/N1tChJ1oVetsLRSDGFT6Uy1 M5BmLK9NGPr8yU5cp3SkX39DeGSuMqI/r9qG+Ee3vfX83GzUU06d7DQNnl3/4y9ZbJIW HSfL34xoljq0Drc0nzX0zcQeH4V74fvfl56C8z3m/KzLelkI8i5P/0uoQbkS26XEQTIi w1AnXFRmHEKdPIrmNC/lGIjb8/MFhjSSAPLKXn4JO6bWbsoj/U9n71+lKxK9uHMeq34e DjDB8w1mmWZtmmQGQjMtjUQoqlA4s4uFS+hA5rVELx8elBtVajxrngp6RJFzJae9E0uX uR7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=/q0blaq9Plszq/mvWW0OupnapM5OEx6p+kGada6ffx0=; b=uJYua8HGvS1vM/mgTwWq7l0EyKRJ9gu3gQLKWbCHpFWNmCsqA7Kds12DrVVz+5mHl/ wCJh0VVlcQTpwgVDCL9ZZoUnU9YwMw17cG8WSA6VBynLUYj7lUGh/mAIlh/elqjR5xWI fdHrMf/bEgs+U0dMrerhumzCIZT4y4OF8vwf1b65cvvRAN88lFW9uyqzlBdLbJMoJorf hdCy3RNg+UO6Og8ZSKRgYLvqAc6lZW284Cum0ZSBHScstD+BGR/blg32BMvvmLPBGTUJ cYJZpBgksLLjdhrP5SJsZcF4rymT78bMCYIvUVTO4yCzUVCX8hhIgeyVbuU5UJZBMnWl IG+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lYlgpw2w; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id o81sor27810184pfk.52.2018.12.05.01.19.20 for (Google Transport Security); Wed, 05 Dec 2018 01:19:20 -0800 (PST) Received-SPF: pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lYlgpw2w; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/q0blaq9Plszq/mvWW0OupnapM5OEx6p+kGada6ffx0=; b=lYlgpw2wcCIaLlJtEVF4sIF7EXJ8/lh9f+ll1KYIIyqtAZWjTkH+4mlIH3/HLQxhHg QzKLgQRkimG+C9vQJte2L/obq7MwixN7K714QM+T0/8izS38vSIeh7gTv1CYHlSEEugE THyyxA8TpkP8iKwA96nvpkHS227aXIm8sdyy3vrOf1JS07Zbf1AecdWhwklZek9wUcxy BYWruZP5n0Lqo5NK2rhQAAfN1v+eoKsYTu7eTLlpnWX6eeNCdlw4xvY6Ksw7F4jEpeHJ +WrvWZn4IluozIA5nYy9isW945R1fQlcChCFoU+fQlVFYJQNVv11JF6rfDS4wMSse4vn xcKA== X-Google-Smtp-Source: AFSGD/UXvrMotNENRty+WVU1tB6DXtAT/mQxHJieW1D5PKLXzG6iTaYfxIeuYkhipZ/PTJckO+RvWQ== X-Received: by 2002:a62:109b:: with SMTP id 27mr23048731pfq.227.1544001559859; Wed, 05 Dec 2018 01:19:19 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 5sm22416656pfz.149.2018.12.05.01.19.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 01:19:19 -0800 (PST) From: Wei Yang To: linux-mm@kvack.org Cc: mgorman@techsingularity.net, akpm@linux-foundation.org, Wei Yang Subject: [PATCH 1/2] mm, pageblock: make sure pageblock won't exceed mem_sectioin Date: Wed, 5 Dec 2018 17:19:04 +0800 Message-Id: <20181205091905.27727-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.15.1 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: X-Virus-Scanned: ClamAV using ClamSMTP When SPARSEMEM is used, there is an indication that pageblock is not allowed to exceed one mem_section. Current code doesn't have this constrain explicitly. This patch adds this to make sure it won't. Signed-off-by: Wei Yang --- include/linux/mmzone.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index be126113b499..8f3ce3a0c7d6 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1084,6 +1084,10 @@ static inline unsigned long early_pfn_to_nid(unsigned long pfn) #error Allocator MAX_ORDER exceeds SECTION_SIZE #endif +#if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS +#error Allocator pageblock_order exceeds SECTION_SIZE +#endif + static inline unsigned long pfn_to_section_nr(unsigned long pfn) { return pfn >> PFN_SECTION_SHIFT;