Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5453949imm; Wed, 12 Sep 2018 06:19:35 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaMf9QXXOpSpFGwz29J+4lkBQl+/8Xb3LoQlUW/h+GN5QOyfnZPpzyQlXS+yOPq+8RyuiDv X-Received: by 2002:a65:6102:: with SMTP id z2-v6mr2332049pgu.46.1536758375172; Wed, 12 Sep 2018 06:19:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536758375; cv=none; d=google.com; s=arc-20160816; b=QUjfGb9JraXLTeZkTg6wFOLRnven0jx13cDPdzd0wJCaWE0zLWKZko1za2j3fWmUeW F1xLhiGS8FsWqMkiRtL/pRK3stLeMT+q6KySVHjTGm+3ErhHQbBEAl4DocqxEPMGtYjT kA3NjAqDXhcssF5SLpbJoodxDiFoohWgzhcdfjU4XdCbdYWT+A7/7cit0pjNabwRYqtK B7dfF2MoCSlNO/y781gbDWMTh59+bmcV2nuCUJ23RNeCKVNbBteDjctPgQDhuU4GmeLw DVh5tQ/tiRloIzpUrP3vdFlKCP8CAWZThRqzAyUU3lE3ba7bVS9V6D/MhxdceuYJpsIG uOww== 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:message-id:subject:cc :to:from:date; bh=/hXQeUjEKOiyi7UWpyN84zWeOBRnGk/cPEMY+tLpcSM=; b=bABQ7mdUETtaZUoC+wIsQdujRF65G8pDhK7vEi+kQFuBql1pKHLxeu3qdPW6148Lly 3nZn3v/c2pPfi8AyjctVfAa2DXE7xhCoIPBmQT6uXbsO0+lf7YAyRWTyKHJGNpnwdWIG WtoGO/zJY5WBRh89uREpGT4zmU5lDTmEaV7GjxIR3a25s2wv39s7SFNL8TM6aYpKnyky ndAE9q6mb2lc4pPCzPhsrv590pU/lis3bYHB56KyES6zVam1cepwExIMbmH/YDsJV9bq pwgfVeJstSGNjXht3WKKfusDR3PDDvmFxZE/MW8/dH//p0XcWUvSgTwChpM5tCdEWjQV zo4g== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c17-v6si1071737pge.273.2018.09.12.06.19.12; Wed, 12 Sep 2018 06:19:35 -0700 (PDT) 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727047AbeILSV4 (ORCPT + 99 others); Wed, 12 Sep 2018 14:21:56 -0400 Received: from mx2.suse.de ([195.135.220.15]:59610 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726640AbeILSV4 (ORCPT ); Wed, 12 Sep 2018 14:21:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A3953AE5F; Wed, 12 Sep 2018 13:17:26 +0000 (UTC) Date: Wed, 12 Sep 2018 15:17:24 +0200 From: Michal Hocko To: Balbir Singh Cc: Arun KS , akpm@linux-foundation.org, dan.j.williams@intel.com, vbabka@suse.cz, pasha.tatashin@oracle.com, iamjoonsoo.kim@lge.com, osalvador@suse.de, malat@debian.org, gregkh@linuxfoundation.org, yasu.isimatu@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, arunks.linux@gmail.com, vinmenon@codeaurora.org Subject: Re: [RFC] memory_hotplug: Free pages as pageblock_order Message-ID: <20180912131724.GH10951@dhcp22.suse.cz> References: <1536744405-16752-1-git-send-email-arunks@codeaurora.org> <20180912103853.GC10951@dhcp22.suse.cz> <20180912125743.GB8537@350D> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180912125743.GB8537@350D> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 12-09-18 22:57:43, Balbir Singh wrote: > On Wed, Sep 12, 2018 at 12:38:53PM +0200, Michal Hocko wrote: > > On Wed 12-09-18 14:56:45, Arun KS wrote: > > > When free pages are done with pageblock_order, time spend 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%. > > > > Where does the improvement come from? You are still doing the same > > amount of work except that the number of callbacks is lower. Is this the > > real source of 60% improvement? > > > > It looks like only the first page of the pageblock is initialized, is > some of the cost amortized in terms of doing one initialization for > the page with order (order) and then relying on split_page and helpers > to do the rest? Of course the number of callbacks reduce by a significant > number as well. Ohh, I have missed that part. Now when re-reading I can see the reason for the perf improvement. It is most likely the higher order free which ends up being much cheaper. This part makes some sense. How much is this feasible is another question. Do not forget we have those external providers of the online callback and those would need to be updated as well. Btw. the normal memmap init code path does the same per-page free as well. If we really want to speed the hotplug path then I guess the init one would see a bigger improvement and those two should be in sync. > > > > > > If this looks okey, I'll modify users of set_online_page_callback > > > and resend clean patch. > > > > [...] > > > > > +static int generic_online_pages(struct page *page, unsigned int order); > > > +static online_pages_callback_t online_pages_callback = generic_online_pages; > > > + > > > +static int generic_online_pages(struct page *page, unsigned int order) > > > +{ > > > + unsigned long nr_pages = 1 << order; > > > + struct page *p = page; > > > + unsigned int loop; > > > + > > > + for (loop = 0 ; loop < nr_pages ; loop++, p++) { > > > + __ClearPageReserved(p); > > > + set_page_count(p, 0); btw. you want init_page_count here. -- Michal Hocko SUSE Labs