From patchwork Thu Aug 23 13:07:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 10573803 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 1295E13B6 for ; Thu, 23 Aug 2018 13:08:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0436A2A590 for ; Thu, 23 Aug 2018 13:08:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E76232A703; Thu, 23 Aug 2018 13:08:15 +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 7EDB12A590 for ; Thu, 23 Aug 2018 13:08:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6CDCF6B2A32; Thu, 23 Aug 2018 09:08:14 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 67B9D6B2A34; Thu, 23 Aug 2018 09:08:14 -0400 (EDT) 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 56AEB6B2A35; Thu, 23 Aug 2018 09:08:14 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f71.google.com (mail-pl0-f71.google.com [209.85.160.71]) by kanga.kvack.org (Postfix) with ESMTP id 16F3E6B2A32 for ; Thu, 23 Aug 2018 09:08:14 -0400 (EDT) Received: by mail-pl0-f71.google.com with SMTP id z24-v6so2537770plo.2 for ; Thu, 23 Aug 2018 06:08:14 -0700 (PDT) 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:in-reply-to:references; bh=uH65SJr5TRDJ1UdXaGxjb9/m2MPypZba/Khufe29heI=; b=rSSKVnP1/B7xKWUScPON/+UTwHi/kRLB/h1Guo8I8YNd/3ma2Hemkk1W02m9zi2nBq tuYnMJbMIEVhetAl7VYPLpMR4mnBuHVEJqfqkffaZxT1eK2tfxV4Z6VzdBQBBAqymaqU 9KrOZ1pkqC8da/i58j0rN90Ri4ZoBJC+2Dx37o28w3qiIjZnwoKWFWcAs+PFrLz7t9os 4dT/kh2F2da9Bp7a8E7kWe2WuyJZnOGwUpbxbnZizPRgBeujrDSlpHKU3pGnnyFOnhFf 0Q8iLr2T4OCWAubo1d/zZK2SgkNKzUoS+CKSM/HrLfCm3d200ULiHyDz/cFpBbdZb18B Nr1g== X-Gm-Message-State: AOUpUlFWEIIu4GqBO16n27R5UyZ/BjxpLYIgEjbUHQktP76/Dg+T+q6Q GkaEwkRu3n5L04kZjL7JTMLjnnMZTsod594LP+DHllItAzqZrE0ITpP/KRxJYG8daN1KrmVzMs/ J321vZAenWHyKTYNB+NLKq1JfVmFA2sBqhJJl5j/BoWmTmGY5lRSJS4Upeznb7Gr1wQpKiz3YzR SBLFqk4xmqIfOJzFstQC5bAARQGj1uG2HFtxyBbQ4I3sQj8gJ6PntR8NXT/3E8h1mzT8/QdDuDR Yh05+bqr5Ka5hwNJFwUjyAX9r8HK8lGieDV7KuzseBg7dr36pm1aJX418Fzk4h71U2/bK2SoKvD ziwtlQqpqycW7u79Wq3Nv/B24D4v+S152R71YVZXQq1Z9nswSlF6AcvH8z1i3HOvv52yzyQVtKG R X-Received: by 2002:a63:ed4f:: with SMTP id m15-v6mr55728021pgk.147.1535029693776; Thu, 23 Aug 2018 06:08:13 -0700 (PDT) X-Received: by 2002:a63:ed4f:: with SMTP id m15-v6mr55727975pgk.147.1535029693131; Thu, 23 Aug 2018 06:08:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535029693; cv=none; d=google.com; s=arc-20160816; b=KKz2KFliHODLPmaOyvG6dqzpFwIIGrIIPhfmVPwEJfY1dCA6qaTaS9QPvDkLxIDqsZ EeYsJPfEOnOnsJq+w/kOLQyT3EWW4ZTkUspeHQ06Z2/2IRgoQ47oulZJyj8FE3q4xfPB yY3e24pLRyNjziOtAvJfKEon+V7jivJCGuQqsifNAvry8dvVe9uKJlP9S9FYSR4S1iW5 efknsZsk6KA1Z+rqxC/Qk/e7sFokdkmE4JwLYeUF6W2d3U6PP7NMGddEzawQXFi5BUX5 puTgx+47BhE1HY5NEM6+hUFRHlVgl3NY8mYtf3876jC7VuUO2EAEpnbmK4MezgmAm0It ReHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=uH65SJr5TRDJ1UdXaGxjb9/m2MPypZba/Khufe29heI=; b=vXaLO8QmxT+EXDtSL8iayMjk6L+GpWbZBT0D4EdCs0z2G2NhL4NQqfmpBAvCvsKLmd DaY8+oPlTIa2o8Yo7g3rHuY9wgWHKLmpTvvhN15hyhv9tUl2hvq8hSfGjLOhws3vhrF+ +qj9mJxIw6Tk1hVYUqT2KMYkK4GnLZo5W5KCUKQqRuycsvNlovPuIhyFnMR00JSwKveS UcT+IAsvq8+6npvppawbdUV5wLXHwjeDUuhRjijlm+n3VyV/Bqr9A7+BPwmUW6bg3DwR TncQPzYEzUEd2uQqN63GoDvMCK/+9ATPSVwR942RKGGF63gGaRgBnKybM4SYvQV0s00C kz/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U9h1BJzt; 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 y7-v6sor1194276pgi.126.2018.08.23.06.08.13 for (Google Transport Security); Thu, 23 Aug 2018 06:08:13 -0700 (PDT) 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=U9h1BJzt; 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:in-reply-to:references; bh=uH65SJr5TRDJ1UdXaGxjb9/m2MPypZba/Khufe29heI=; b=U9h1BJztmbukqQK0n5J56np4eiYs98+Bai6yTJSvYiAWx3KnBaZ7y877KtppthEXBi XXgSg22Vm+pPF4wa4y6htRdtt/SMmx5ah78MS89cytUq31iPeYrasOwYbi8dyqYqXLbs GGKjqO/c12ur+z8HnSTilwHDK9tK1iMSVB7fm+GidnKTnA4MeSOjuDDl8krPfIr52Hyr +pFmxXFSnc1lzsRTsZmdWULqyRzG06WuiEkmp+dibsCxOAAVbf6lrZZend44vR27C4JD 8+A5i9jMaXaBiYo51tp1k2ZOVYC2TSpsV93+Q0sz/+haTwV7esEk12e6Jrp7paJeekN/ Eb5g== X-Google-Smtp-Source: AA+uWPzaYZwAJzKrfFI5ieN56o7zq4YufZx5cbBwuM04XyC6V3PYlS1iUy6crVi9kSC/AJSTD7Ix5g== X-Received: by 2002:a63:e056:: with SMTP id n22-v6mr55700850pgj.205.1535029692896; Thu, 23 Aug 2018 06:08:12 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id t21-v6sm7525580pfi.73.2018.08.23.06.08.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Aug 2018 06:08:12 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, mhocko@suse.com, rientjes@google.com Cc: linux-mm@kvack.org, kirill.shutemov@linux.intel.com, bob.picco@hp.com, Wei Yang Subject: [PATCH 2/3] mm/sparse: expand the CONFIG_SPARSEMEM_EXTREME range in __nr_to_section() Date: Thu, 23 Aug 2018 21:07:31 +0800 Message-Id: <20180823130732.9489-3-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180823130732.9489-1-richard.weiyang@gmail.com> References: <20180823130732.9489-1-richard.weiyang@gmail.com> 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 CONFIG_SPARSEMEM_EXTREME is not defined, mem_section is a static two dimension array. This means !mem_section[SECTION_NR_TO_ROOT(nr)] is always true. This patch expand the CONFIG_SPARSEMEM_EXTREME range to return a proper mem_section when CONFIG_SPARSEMEM_EXTREME is not defined. Signed-off-by: Wei Yang --- include/linux/mmzone.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 32699b2dc52a..33086f86d1a7 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1155,9 +1155,9 @@ static inline struct mem_section *__nr_to_section(unsigned long nr) #ifdef CONFIG_SPARSEMEM_EXTREME if (!mem_section) return NULL; -#endif if (!mem_section[SECTION_NR_TO_ROOT(nr)]) return NULL; +#endif return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; } extern int __section_nr(struct mem_section* ms);