Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5266442imm; Wed, 12 Sep 2018 03:39:36 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda+NRHkkHEdvMeR6fPFZx7thMLAVSceSz6bQiskttINjfOV0ixC+q+QRtk08ER3TOaZkT+Y X-Received: by 2002:a62:aa02:: with SMTP id e2-v6mr1500260pff.211.1536748776242; Wed, 12 Sep 2018 03:39:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536748776; cv=none; d=google.com; s=arc-20160816; b=qMkEh52WcQ6W45tM9SWJPMaPrHB8wj5BLUn+HafYaUSXWt9ocH4UO7iT9eX5VTbw3L TftG5ccsW02QU69dyf5w9FVL+xPdP5367dVd3KdOSmsVmtfabxxQoQ1MVcNBhGgYtqMQ bF/7qbYmaF6VSTLZVFpEXvKi1jXL93g3RppVVnCY0KzhtMM8gx6q1yENhe6pMJraQK+d 2fNZ2RiJhF5uGe+a0gzdjmYtrv8bzW4Di2GGjopcrPZtZ4Dpvjqvh9SOCTaytjt2Bpms 0NGdYC3SeEY4WasD6MKDcltrVxhE6K70EcGkmfq5/FD/+mrl9kKE+nRrQQhHahjJ/fLl QfyA== 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=GUqEsBkuFK7MXHE2hbHtw6OXCuuaCnklFaxWhdtJeTE=; b=lgeEnDpQ7v9OINqzNWfEGofZ9pYZqnEvDdIU3t2SsF9yCj7RngnqVgSf5t80gJxT5h TB1TAJONqJjwbCgpAiZImqZr1nwHqc/oLsjG+iVQHniWbhEt0i41xTcoHw5iko028iOB C8rh4OL7SvNl7Ljin/zIUiUjEFkSY7JzQC0dn3G1WL/42WLgfLczq7ZjcVCJ+c+K+iQc Z8RrPPv0btwFz3sg0GooZ2nYxNtVbG6CEQkaUzVPTl6onatX0kLWnFbn6A7lXyWJ/DwK UQK1Ld3vnx3ZqSvwaOgURAFG2wYf+QB6H2MJZwLAKrl1mSiAJvbYHk6+pcpsSjpzP4cF HgWQ== 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 n7-v6si616889pgp.411.2018.09.12.03.39.21; Wed, 12 Sep 2018 03:39:36 -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 S1728001AbeILPmw (ORCPT + 99 others); Wed, 12 Sep 2018 11:42:52 -0400 Received: from mx2.suse.de ([195.135.220.15]:35512 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726970AbeILPmw (ORCPT ); Wed, 12 Sep 2018 11:42:52 -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 5994DADEF; Wed, 12 Sep 2018 10:38:54 +0000 (UTC) Date: Wed, 12 Sep 2018 12:38:53 +0200 From: Michal Hocko To: Arun KS Cc: 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: <20180912103853.GC10951@dhcp22.suse.cz> References: <1536744405-16752-1-git-send-email-arunks@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1536744405-16752-1-git-send-email-arunks@codeaurora.org> 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 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? > > 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); > + } > + adjust_managed_page_count(page, nr_pages); > + init_page_count(page); > + __free_pages(page, order); > + > + return 0; > +} > + > +static int online_pages_blocks(unsigned long start_pfn, unsigned long nr_pages) > +{ > + unsigned long pages_per_block = (1 << pageblock_order); > + unsigned long nr_pageblocks = nr_pages / pages_per_block; > +// unsigned long rem_pages = nr_pages % pages_per_block; > + int i, ret, onlined_pages = 0; > + struct page *page; > + > + for (i = 0 ; i < nr_pageblocks ; i++) { > + page = pfn_to_page(start_pfn + (i * pages_per_block)); > + ret = (*online_pages_callback)(page, pageblock_order); > + if (!ret) > + onlined_pages += pages_per_block; > + else if (ret > 0) > + onlined_pages += ret; > + } Could you explain why does the pages_per_block step makes any sense? Why don't you simply apply handle the full nr_pages worth of memory range instead? > +/* > + if (rem_pages) > + onlined_pages += online_page_single(start_pfn + i, rem_pages); > +*/ > + > + return onlined_pages; > +} > + > static int online_pages_range(unsigned long start_pfn, unsigned long nr_pages, > void *arg) > { > - unsigned long i; > unsigned long onlined_pages = *(unsigned long *)arg; > - struct page *page; > > if (PageReserved(pfn_to_page(start_pfn))) > - for (i = 0; i < nr_pages; i++) { > - page = pfn_to_page(start_pfn + i); > - (*online_page_callback)(page); > - onlined_pages++; > - } > + onlined_pages = online_pages_blocks(start_pfn, nr_pages); > > online_mem_sections(start_pfn, start_pfn + nr_pages); > > -- > 1.9.1 > -- Michal Hocko SUSE Labs