Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp822543ybv; Wed, 5 Feb 2020 15:22:45 -0800 (PST) X-Google-Smtp-Source: APXvYqyAmAjAVM0tXaL7AFbJ1o+N78zxw7O9KizFoPS02oeusZFjba21U7npObF5Q0fYFXhkWsJO X-Received: by 2002:aca:b187:: with SMTP id a129mr4950242oif.175.1580944964967; Wed, 05 Feb 2020 15:22:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580944964; cv=none; d=google.com; s=arc-20160816; b=HGhwFuIPCvgbx3aXG7HXifvyYbMFk5GfONmj1182wnLgIyDtxIHeMO++9CAJliZzy6 rTqXA9Xt4bIIrpgdV+LyV78xbUyAgxBcyh1q15hMp44q9UnHxvsyQ70jPw3NJA8sX6Fx bLnZvgnmPi79N7pNJhpGnV949zsBO/xHZ5kMm6AUiuaoxJ7xbStDZTkcNccYFHvf1Irf jG2T9yBm+0jitlp+p+VmZjc5sYMTvkDTd5v1UX4vJsb8hw8t4hN7iS/g7q1DUPpZQnpv wTaTqe6KqJPJTAthTEZ0ZOuwrUoP6B8MQ/EtAVn1K8X3dHdcqIB6zd4I42GhvH0QUEmI yVag== 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; bh=rkKeG12vV2ocby6F9ssWH/Pdh8cfGuy/q7rUUfZzAPw=; b=ptiyMpCUlrQVr5lmnO9ndxaGsc/ZNSGqm0yJ2IRBJjeXlJnKaZOaUAqIRn1ayIK00a bnAzPJn+z8peC0crO0/chUnCTPk24w5uC6sCVnuLElDFqV17k2c+DH3T1e2P4BWwQGvJ IQS0ZOHWat/AUVrJtSrvQcxd78859iZqZ+rYIvAXr8MH6XZkneFKqRccMWRy7lvc3IlL dQb3+Ct5ka+Vw7sOdRFHPWaIH4HfoZXU7KnQXckBs8r8fxvdzv06UOiW9b1VQoKdtoby kXepwB/mToNPDT9YurBd8T7ERSEmRcZokPmJZ4R7tLx72eCDi4rT/X79YrjIkwDUrepd dMVQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s204si1191331oie.82.2020.02.05.15.22.32; Wed, 05 Feb 2020 15:22:44 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727486AbgBEXTb (ORCPT + 99 others); Wed, 5 Feb 2020 18:19:31 -0500 Received: from mga18.intel.com ([134.134.136.126]:53775 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727149AbgBEXTb (ORCPT ); Wed, 5 Feb 2020 18:19:31 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Feb 2020 15:19:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,407,1574150400"; d="scan'208";a="224817012" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga008.jf.intel.com with ESMTP; 05 Feb 2020 15:19:28 -0800 Date: Thu, 6 Feb 2020 07:19:45 +0800 From: Wei Yang To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Segher Boessenkool , Andrew Morton , Michal Hocko , Oscar Salvador , Baoquan He , Wei Yang Subject: Re: [PATCH v1] mm/memory_hotplug: Easier calculation to get pages to next section boundary Message-ID: <20200205231945.GB28446@richard> Reply-To: Wei Yang References: <20200205135251.37488-1-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200205135251.37488-1-david@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 05, 2020 at 02:52:51PM +0100, David Hildenbrand wrote: >Let's use a calculation that's easier to understand and calculates the >same result. Reusing existing macros makes this look nicer. > >We always want to have the number of pages (> 0) to the next section >boundary, starting from the current pfn. > >Suggested-by: Segher Boessenkool >Cc: Andrew Morton >Cc: Michal Hocko >Cc: Oscar Salvador >Cc: Baoquan He >Cc: Wei Yang >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang BTW, I got one question about hotplug size requirement. I thought the hotplug range should be section size aligned, while taking a look into current code function check_hotplug_memory_range() guard the range. This function says the range should be block_size aligned. And if I am correct, block size on x86 should be in the range [MIN_MEMORY_BLOCK_SIZE, MEM_SIZE_FOR_LARGE_BLOCK] And MIN_MEMORY_BLOCK_SIZE is section size. Seems currently we support subsection hotplug? Then how a subsection range got hotplug? Or this patch is a pre-requisite? >--- > 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 0a54ffac8c68..c30191183c04 100644 >--- a/mm/memory_hotplug.c >+++ b/mm/memory_hotplug.c >@@ -528,7 +528,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