Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp665880ybf; Fri, 28 Feb 2020 05:27:30 -0800 (PST) X-Google-Smtp-Source: APXvYqx5Q9fI1Iwqf9upanBxdBVSY9uChSE2KnudXekutthYq1gcpVnsOqM19cn5M42B2hdvzM9a X-Received: by 2002:a9d:48d:: with SMTP id 13mr3089315otm.249.1582896450257; Fri, 28 Feb 2020 05:27:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582896450; cv=none; d=google.com; s=arc-20160816; b=TYzFFitYq1uRtu8kMYNsW/cNsQgU23bkWoXP29VLiL6j0KiSILc6MITbuzOP+0LK3s MEoP407eInOdu58XusJAySbrluWwORcjQFwQwQ8A2vsbr/T4wPseMUZdcD9JXv88iO8s pA518QabfmsmQG9ikw5B+y7vcUshKJnTbBQyshWc8xM5jiQOGGyZJ/BRtnlOVlC3V5El PYyGRrkNU2ynT2gf5c4GbUS9FIXE+0uWodheLA/CpTQpFA0HWtgdhWAzmNnNhVLM50Qu BJqq/dsTKYmGsP2gHfdnTupEFOsWxm8Dy/cyl68f5OjFlrMd0pH19V7XDn/D/ZWfRRqN aBGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=w3l+XVJLXhdwqxBw3BBK4v/KZHF0nIb1lLNrBLU24AE=; b=HtMT78E94pSoXmFOntiA79CaVQy7ovSx/M+C69zf/7jMU2Z8lT9d9fE3E8FBS5Ksp8 ghK5bMX6Lutywf4hFzCJwDxXOzisF6H+73ocr2mKr+WS3IMr/qOXlyGG6diHUOGGQTGe uymO7l6vdaBnxvDYWGNbDHP9fP4h5vYfw+ZJoZXkMqi3sHKW/hOJzCnJIQjdlbsMashH vpPB6BZN6s1SqU2NG0Giu4MhynVYqViq9oR1VCUmlMpzzR0Oh8xjV7ek5KSod4u7MaOl /5050+RotvkAUIt4VtoJvGy8h+9ywgOjnf1Miumk7P1syKEIQ8Fg+O4JMzRU9o1fNPva aShg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fhcWiaKi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o2si1617463otj.312.2020.02.28.05.27.18; Fri, 28 Feb 2020 05:27:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fhcWiaKi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726589AbgB1N0D (ORCPT + 99 others); Fri, 28 Feb 2020 08:26:03 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41855 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbgB1N0C (ORCPT ); Fri, 28 Feb 2020 08:26:02 -0500 Received: by mail-wr1-f65.google.com with SMTP id v4so2919842wrs.8 for ; Fri, 28 Feb 2020 05:26:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=w3l+XVJLXhdwqxBw3BBK4v/KZHF0nIb1lLNrBLU24AE=; b=fhcWiaKiDQfLzC2qCFVmeJuphoSsdqLxx3OiO1/IAQ5QIP7XJg7iy63OTTlOe6pRrh lCmP2XB0xcWV4YBB4cOfPscRf1NtYc/B1tTXIdxH6ry6UUNu8b7kd35qgDtGrCJJn0zg 0nkRuv4SmK842b1oR9RC84zwtpmPslGZyHZ4KFbec+lPgSljmhWhBAnIBSnMRHqv3ViK AoqyC4bx6Nkum+est8oYdwQk1fBOOBS+plsAprNzInv8/Cz3ZlgG11P23uw3bJvg7DIZ NVzUxYLy001190fclR6XdzmvO8McM09KD9rjby3dSvO/bamxSfA51NgSPt6omkENG6vN gabg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=w3l+XVJLXhdwqxBw3BBK4v/KZHF0nIb1lLNrBLU24AE=; b=FWEcZVjcbjU9JqFhhXMaKcGzWqyC8VmuvPyoxdeAvrymjKHBnexTdrFbc9LZFrloPN xRmnEZkbhHu7/R2Vx0LGd16c9CS7/tI08A7Y/WYOt0/lhclgCnnbGKvZwLD2Yckkm47t nuHWK1AsZ9GU8TUr6X29YPmImvC4sy/LhO4NqZsEDDf0TNRCd5QK4fe/hmuEW5IV4Gv9 /Q1nxahpiawNCZdzV2EIA4FkazBL2vV0PIE/OiO8m6PEByj9Uk6wlv8VJ9U30YfZ3ciX bTWN14hlp+p9ZUG5/5aUzXAM8TCpojCLpMn2W8FzwAxxFmuCpYd8OgSA+KY/2Z5e1CBd sFnQ== X-Gm-Message-State: APjAAAXo3D/XgU2We1JUR4Nwqfb6ZdkTnYegwYNC92J2RUMzzTZh6ZoF AgK7sjXES0iej5gxW71E1f1AYJI8 X-Received: by 2002:a5d:6ac1:: with SMTP id u1mr4603578wrw.383.1582896360638; Fri, 28 Feb 2020 05:26:00 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id p15sm2194720wma.40.2020.02.28.05.25.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Feb 2020 05:26:00 -0800 (PST) Date: Fri, 28 Feb 2020 13:25:59 +0000 From: Wei Yang To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Segher Boessenkool , Andrew Morton , Oscar Salvador , Michal Hocko , Baoquan He , Dan Williams Subject: Re: [PATCH v2 1/2] mm/memory_hotplug: simplify calculation of number of pages in __remove_pages() Message-ID: <20200228132559.lbzci6eiwz52quhn@master> Reply-To: Wei Yang References: <20200228095819.10750-1-david@redhat.com> <20200228095819.10750-2-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200228095819.10750-2-david@redhat.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 28, 2020 at 10:58:18AM +0100, David Hildenbrand wrote: >In commit 52fb87c81f11 ("mm/memory_hotplug: cleanup __remove_pages()"), >we cleaned up __remove_pages(), and introduced a shorter variant to >calculate the number of pages to the next section boundary. > >Turns out we can make this calculation easier to read. We always want to >have the number of pages (> 0) to the next section boundary, starting from >the current pfn. > >We'll clean up __remove_pages() in a follow-up patch and directly make >use of this computation. > >Suggested-by: Segher Boessenkool >Cc: Andrew Morton >Cc: Oscar Salvador >Cc: Michal Hocko >Cc: Baoquan He >Cc: Dan Williams >Cc: Wei Yang >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang >--- > mm/memory_hotplug.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c >index 4a9b3f6c6b37..8fe7e32dad48 100644 >--- a/mm/memory_hotplug.c >+++ b/mm/memory_hotplug.c >@@ -534,7 +534,8 @@ void __remove_pages(unsigned long pfn, unsigned long nr_pages, > for (; pfn < end_pfn; pfn += cur_nr_pages) { > cond_resched(); > /* Select all remaining pages up to the next section boundary */ >- cur_nr_pages = min(end_pfn - pfn, -(pfn | PAGE_SECTION_MASK)); >+ cur_nr_pages = min(end_pfn - pfn, >+ SECTION_ALIGN_UP(pfn + 1) - pfn); > __remove_section(pfn, cur_nr_pages, map_offset, altmap); > map_offset = 0; > } >-- >2.24.1 -- Wei Yang Help you, Help me