Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp249435imu; Tue, 15 Jan 2019 21:08:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN5RdiuuelKYNxNyUmf9AxXFpEyzAbL3Pu4tjOPQts1AXmUUpeyuZqa4l5KVh+aopQ50bFdW X-Received: by 2002:a17:902:2dc3:: with SMTP id p61mr7781042plb.166.1547615301042; Tue, 15 Jan 2019 21:08:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547615301; cv=none; d=google.com; s=arc-20160816; b=SP85pV7KLJ6MzWDXTQ+5j8Fg2HyxMH7yClC5sjcCERaVJVdkSXcZAD7wJ2uWrD4zCf QjgV1/ee0pItjezdfqz/ZfE8gybxGsspu1yYt5/xL0RAP/8WEpbIq7Kjr8q1+X1vTHyl I3LdauvZSK47TZ33DTZH1FMKW3ASmrvF0ef7fa6tAjOl3UOobeQ8pbWrDjhdK9Ox18la PvNypi6Z9Gp/p8FYsMmeiCe56dqYk2V2Q9llbBMRJzBBRZ30e54CQjLGHxMBHaQqmqi9 +rsPdgsvIjRAFY9s68F5JiCTM0TKyQj1hEp+LdYoDUbV8u3QWqgfzeNSS+odiI1MXVU5 3pMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=0c7evrTAwq9ca1jWD7AsAP7FXRUT/laZLINdYKwSZyk=; b=yhYzPf9dcB1ZnvQ9eBxSBmfhpckiPBTh/4IdjY3CFiejyHm55UCWWALB/zkXpW39KY nvAIxyGe1iND6MDAqKMiKYc8VrhKJOKnToDciHWEKm4B+1quMtzm8Q0bE/tVBtG0MCSP x0k6pM2bjyk52TKoYpYlot91VpV4SoA0U/v+tX/2W1nzDF6Luj+dIT1QzqomTsWWtUHF I0WKUGKnFTbACyd4kZwnfkYDiJUEjC/SdZVr78dg71d2ywaClSsK51WJjRvkfcygDV/E bBT/6q0WtsLRdi9/TnUwOiEx0ngt/bQVw4yTZr+HeF4w6vr+0sOvVj+mYbk9IqH0o6xY bKUw== 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 z22si5544770pfd.197.2019.01.15.21.08.02; Tue, 15 Jan 2019 21:08:21 -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 S1732795AbfAORei (ORCPT + 99 others); Tue, 15 Jan 2019 12:34:38 -0500 Received: from mga04.intel.com ([192.55.52.120]:14048 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726022AbfAORei (ORCPT ); Tue, 15 Jan 2019 12:34:38 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2019 09:34:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,481,1539673200"; d="scan'208";a="127980887" Received: from ahduyck-desk1.jf.intel.com ([10.7.198.76]) by orsmga001.jf.intel.com with ESMTP; 15 Jan 2019 09:34:37 -0800 Message-ID: <9bc20a9f2f5d6a99afa61ad68d827090553c09fe.camel@linux.intel.com> Subject: Re: [PATCH v10] mm/page_alloc.c: memory_hotplug: free pages as higher order From: Alexander Duyck To: Arun KS , arunks.linux@gmail.com, akpm@linux-foundation.org, mhocko@kernel.org, vbabka@suse.cz, osalvador@suse.de, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: getarunks@gmail.com Date: Tue, 15 Jan 2019 09:34:37 -0800 In-Reply-To: <1547571068-18902-1-git-send-email-arunks@codeaurora.org> References: <1547571068-18902-1-git-send-email-arunks@codeaurora.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-2.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-01-15 at 22:21 +0530, Arun KS wrote: > When freeing pages are done with higher order, time spent on coalescing > pages by buddy allocator can be reduced. With section size of 256MB, hot > add latency of a single section shows improvement from 50-60 ms to less > than 1 ms, hence improving the hot add latency by 60 times. Modify > external providers of online callback to align with the change. > > Signed-off-by: Arun KS > Acked-by: Michal Hocko > Reviewed-by: Oscar Salvador > Reviewed-by: Alexander Duyck > --- > Changes since v9: > - Fix condition check in hv_ballon driver. > > Changes since v8: > - Remove return type change for online_page_callback. > - Use consistent names for external online_page providers. > - Fix onlined_pages accounting. > > Changes since v7: > - Rebased to 5.0-rc1. > - Fixed onlined_pages accounting. > - Added comment for return value of online_page_callback. > - Renamed xen_bring_pgs_online to xen_online_pages. > > Changes since v6: > - Rebased to 4.20 > - Changelog updated. > - No improvement seen on arm64, hence removed removal of prefetch. > > Changes since v5: > - Rebased to 4.20-rc1. > - Changelog updated. > > Changes since v4: > - As suggested by Michal Hocko, > - Simplify logic in online_pages_block() by using get_order(). > - Seperate out removal of prefetch from __free_pages_core(). > > Changes since v3: > - Renamed _free_pages_boot_core -> __free_pages_core. > - Removed prefetch from __free_pages_core. > - Removed xen_online_page(). > > Changes since v2: > - Reuse code from __free_pages_boot_core(). > > Changes since v1: > - Removed prefetch(). > > Changes since RFC: > - Rebase. > - As suggested by Michal Hocko remove pages_per_block. > - Modifed external providers of online_page_callback. > > v9: https://lore.kernel.org/patchwork/patch/1030806/ > v8: https://lore.kernel.org/patchwork/patch/1030332/ > v7: https://lore.kernel.org/patchwork/patch/1028908/ > v6: https://lore.kernel.org/patchwork/patch/1007253/ > v5: https://lore.kernel.org/patchwork/patch/995739/ > v4: https://lore.kernel.org/patchwork/patch/995111/ > v3: https://lore.kernel.org/patchwork/patch/992348/ > v2: https://lore.kernel.org/patchwork/patch/991363/ > v1: https://lore.kernel.org/patchwork/patch/989445/ > RFC: https://lore.kernel.org/patchwork/patch/984754/ > --- > drivers/hv/hv_balloon.c | 4 ++-- > drivers/xen/balloon.c | 15 ++++++++++----- > include/linux/memory_hotplug.h | 2 +- > mm/internal.h | 1 + > mm/memory_hotplug.c | 37 +++++++++++++++++++++++++------------ > mm/page_alloc.c | 8 ++++---- > 6 files changed, 45 insertions(+), 25 deletions(-) > > diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c > index 5301fef..2ced9a7 100644 > --- a/drivers/hv/hv_balloon.c > +++ b/drivers/hv/hv_balloon.c > @@ -771,7 +771,7 @@ static void hv_mem_hot_add(unsigned long start, unsigned long size, > } > } > > -static void hv_online_page(struct page *pg) > +static void hv_online_page(struct page *pg, unsigned int order) > { > struct hv_hotadd_state *has; > unsigned long flags; > @@ -780,10 +780,11 @@ static void hv_online_page(struct page *pg) > spin_lock_irqsave(&dm_device.ha_lock, flags); > list_for_each_entry(has, &dm_device.ha_region_list, list) { > /* The page belongs to a different HAS. */ > - if ((pfn < has->start_pfn) || (pfn >= has->end_pfn)) > + if ((pfn < has->start_pfn) || > + (pfn + (1UL << order) >= has->end_pfn)) This check should be ">" has->end_pfn, not ">=". > continue; > > - hv_page_online_one(has, pg); > + hv_bring_pgs_online(has, pfn, (1UL << order)); Also the parenthesis around "1UL << order" are unnecessary. > break; > } > spin_unlock_irqrestore(&dm_device.ha_lock, flags); The rest of this looks fine to me.