Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5555758imm; Wed, 12 Sep 2018 07:43:48 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYKibSu5QE0xtolmlZmPG1/Z0UlXXndHHrdH+kh/t1e3A6almjGtn8+2l22XNNmA0qgceSm X-Received: by 2002:a17:902:f205:: with SMTP id gn5mr2647681plb.41.1536763428778; Wed, 12 Sep 2018 07:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536763428; cv=none; d=google.com; s=arc-20160816; b=IO3LTfNJ93YPfvUkgyS1brQnBQAvGBUeMi+aU843SZwltcfTAgBNC6s5dcYMYLTk2Z 972zWR4uO5brGgMpP5KVDKZb7lig1Z51ifjhRq6xt4DgitDYhFe35QNyWYVCbfFKQ35r shfJq6bJM0yApvd85wCZwrbp+GNxU8KICBgd0KM8l8Xs5pGFeV3YHYbAsb6NqiWCh0Nw 32DEOfvLpf3F2buq2D/13EbrTW9EfB04mZUoETIwnKzIkxto73gtIsTt7OmlJ7L9Ayle J5KaB7IHmgnHzmt3iY0bmqQ/vPF6UDVeONhZxuy3bwfOPxRRx9fY0XEst/b3IOGVEsnE 6NbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature; bh=hOAsm9N01tiso/sfTMqzSzQHzWWZcAspquMC8dZkfzk=; b=XH8sGD+PdJE6/7BBqxj2uc7C9ZDMtbY50EJZsxv16AH/gui8wg/mQ8SQJB5OAMpSep Ue7Jv5L9oPxRkvpMZunaZv7/jaKzKUyZck2Lb1Krkp6qjzanqRSpZbSLk/dv8qeAlE25 8V7rNifVRQ4xNamGf1KdfwwNS6pf71UmKMiLTms1I5XAwBKEfGuunh7VGKkU4mcxlv3h ny0enbLdTHSbEsF2CT2nQeReIrhzFlytrJY9JAXOSBZm2iVHEHko+gzQJyKD9NMcyd6z IBKB6ucs0nMzkaMmpuc7g8rk0czRHLdv/OSaQlmddty/Fs1uskKbsA5HAe4i1P/9tLo7 /5qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=KsXuAy7a; dkim=pass header.i=@codeaurora.org header.s=default header.b="nPHP/nmx"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r7-v6si1175813pli.248.2018.09.12.07.43.26; Wed, 12 Sep 2018 07:43:48 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=KsXuAy7a; dkim=pass header.i=@codeaurora.org header.s=default header.b="nPHP/nmx"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728122AbeILTrV (ORCPT + 99 others); Wed, 12 Sep 2018 15:47:21 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:53998 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726879AbeILTrU (ORCPT ); Wed, 12 Sep 2018 15:47:20 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8F90B609A1; Wed, 12 Sep 2018 14:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1536763351; bh=mMNCRBxP2jb4BjZi+5VDn0hkkpfgPYK5eSngb/Klr5M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KsXuAy7aIb4xNZpORV+918QaBmGzsYDjxYUnaCJ/Ev2grgGIOOPwkfauxMWNi9+fe HdHn1z4LJBObUB1Nwn7s2qM5KroBrhDuip1ggq6GUvNS49NB92/+0JWpOGve8ErseF 5BUtwbm4PMsQOUBrFHJ8MBP2UsVS435aG4oHmLv8= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 38E696053B; Wed, 12 Sep 2018 14:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1536763350; bh=mMNCRBxP2jb4BjZi+5VDn0hkkpfgPYK5eSngb/Klr5M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nPHP/nmxkxVmLk+nqzwwBfnad3P2ptdcAAbXovpWesjYA6c4bE03GKNOH+2SfI3TY Qwxf8bV7coIrM36W7/IQklgv1RmEGwHxkBndiLPLlD26FweiW5DzkFeXWjwF6NUU5t sM3y2Z7+9SVG2IYP1XiR73McS6spdJPvBGn65Wmk= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 12 Sep 2018 20:12:30 +0530 From: Arun KS To: Michal Hocko Cc: Balbir Singh , 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 In-Reply-To: <20180912131724.GH10951@dhcp22.suse.cz> References: <1536744405-16752-1-git-send-email-arunks@codeaurora.org> <20180912103853.GC10951@dhcp22.suse.cz> <20180912125743.GB8537@350D> <20180912131724.GH10951@dhcp22.suse.cz> Message-ID: <9d8dfd50046036a7b4e730738940014d@codeaurora.org> X-Sender: arunks@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-09-12 18:47, Michal Hocko wrote: > 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. Sure Michal, I ll look into this. > > 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. Thanks for pointers, Will look further. > >> > > >> > > 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. Do you mean replace set_page_count(p, 0) with init_page_count(page)? Because init_page_count is setting the page _refcount to 1 static inline void init_page_count(struct page *page) { set_page_count(page, 1); } I thought in case of higher order pages only the first struct page should have _refcount to 1 before calling __free_pages(). Please correct me if wrong. Regards, Arun