From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 6D573C3F2D1 for ; Fri, 28 Feb 2020 10:23:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 22C652469F for ; Fri, 28 Feb 2020 10:23:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QLwIe1zG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22C652469F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C021A6B0005; Fri, 28 Feb 2020 05:23:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B8CF46B0006; Fri, 28 Feb 2020 05:23:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A53796B0007; Fri, 28 Feb 2020 05:23:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0231.hostedemail.com [216.40.44.231]) by kanga.kvack.org (Postfix) with ESMTP id 8942F6B0005 for ; Fri, 28 Feb 2020 05:23:08 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4B5A38245578 for ; Fri, 28 Feb 2020 10:23:08 +0000 (UTC) X-FDA: 76539148056.27.sofa24_387734aa7120d X-HE-Tag: sofa24_387734aa7120d X-Filterd-Recvd-Size: 3983 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Fri, 28 Feb 2020 10:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582885387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UxuggNNzearR180tpKOC+gN2nR4ttuW45PhgH1v5/2w=; b=QLwIe1zGBi+ywmi8LVF2UeJbMRcT8ZwtgPdoSunqruyli7aJy0JkP0MnngYQIosdbukDLX ncKfs3TcOwVX8D9UZkRRkT0zxWnK22H+dPrT50pInYmMKL++QL8kuWAJxx5bUMhm9wvJu8 hQzQPmuEtL1VxcMbqgvqLpEQPUgT45I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-276-ttNN7RDmOGKWZpNVOC-gPw-1; Fri, 28 Feb 2020 05:23:02 -0500 X-MC-Unique: ttNN7RDmOGKWZpNVOC-gPw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 00B7D107ACC9; Fri, 28 Feb 2020 10:23:01 +0000 (UTC) Received: from localhost (ovpn-12-49.pek2.redhat.com [10.72.12.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E60C101D48A; Fri, 28 Feb 2020 10:22:57 +0000 (UTC) Date: Fri, 28 Feb 2020 18:22:54 +0800 From: Baoquan He To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Segher Boessenkool , Andrew Morton , Oscar Salvador , Michal Hocko , Dan Williams , Wei Yang Subject: Re: [PATCH v2 1/2] mm/memory_hotplug: simplify calculation of number of pages in __remove_pages() Message-ID: <20200228102254.GL4937@MiWiFi-R3L-srv> 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: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: On 02/28/20 at 10:58am, 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 > --- > 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); Reviewed-by: Baoquan He