Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp113727imm; Fri, 5 Oct 2018 00:25:32 -0700 (PDT) X-Google-Smtp-Source: ACcGV61OwuP6Pr2CrtW2mJSx9E+RVzU41FxcFItES4PLxjzwFHRvEwB+J+CZIlvz1KJc/wlE1WnX X-Received: by 2002:a62:571b:: with SMTP id l27-v6mr10598687pfb.209.1538724332626; Fri, 05 Oct 2018 00:25:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538724332; cv=none; d=google.com; s=arc-20160816; b=xS9DlRmZaWFbZ2QswbHQpELy3YaoD48bxHxO+0/+5z2ZWjEJqQp9wiOAGLCwRVppNS gioqArFP4j4RhQ29z3LcekRRO7sD1WV+JRgtX9H0jmsiy+zJ5Q8UIdnaMsE8bM5hNGSt +JRT4hzArF2v2zMHX4/5/jih4jHtjGGvBW6PofPswmbFBNMIv/4EloU3FuSYM0DwgXGQ OP2MPLr7swA8+YAZFlchgthsWA6eo7/9AZ2FZTOoCdMmJh0AjCS6VUmqOv6aYvTNHqtZ dtF5g8MGRJJtXSV0qS8l/9rC15Ym1aoLTph353KReK5Vxvz/3TZd7xfKVfUG0xXQ628C kEKg== 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=2iBRs0TsDgtPt0c0TvkmzwLqBscMyavG7Dn25jcFT9M=; b=hDuDTLAdy1PCPEObFFzjDKXJee2mYo+yO4//EGf4G/iWO1C0z4yzTuxLwSf2ZC8+0m ssi/4mYxO9r+ba69Vv22eEbEC5lV7mfjPvSYsOzVPyIC/616lIi32hHS3734aPyUrfll X+k3+uOhQYC91i8VltgT2vAYp732B9oyBKbePmqHOMul851aE+Wj7wA7GmXdQKVhxHSz TJUU4fvEj2eXTr0iCqHSWMS5FjmLb62PsyeZ5nAq61QRNAYyBGQ3ZHlMlJyF1jPWMFLP LXSdkWtTjm74bN8IZWCIp0IXY4Z5PIEBO+0bKvErCGFCBFHG2nsm3eFNZRFLb4W1W3iH WVwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=OZ4+7ydT; dkim=pass header.i=@codeaurora.org header.s=default header.b=f0vuY2V8; 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 o38-v6si6221030pgl.107.2018.10.05.00.25.16; Fri, 05 Oct 2018 00:25:32 -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=OZ4+7ydT; dkim=pass header.i=@codeaurora.org header.s=default header.b=f0vuY2V8; 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 S1728304AbeJEOWN (ORCPT + 99 others); Fri, 5 Oct 2018 10:22:13 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:49950 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727768AbeJEOWN (ORCPT ); Fri, 5 Oct 2018 10:22:13 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9729B60C72; Fri, 5 Oct 2018 07:24:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538724287; bh=NIX8VMloPWrwsEOvJqzrL0iO5uHzA015ASINX4eBK9M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=OZ4+7ydT1U0t/FybaRnFnHeVyL/6RyXOiRWQaasI0zomtAcMhvMi3UIbakMLbvtBa M6zhgzhhF2/3DNCQCgD6tftGSJkxUzMAVQ5wbq+5G+wHv3eXZlw6WuX2nsEIStq484 H9s8p5q89G5EvFpZK1yu/iL1eQ+yBIiq9SUrvm3Q= 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.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED 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 11E6160818; Fri, 5 Oct 2018 07:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538724286; bh=NIX8VMloPWrwsEOvJqzrL0iO5uHzA015ASINX4eBK9M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=f0vuY2V8S9O3efCBZXVBhazWs8Lx0djtvmYJR4aA2obmAoQRitZ0B12Sdc1wc52CR JgLgAPFj7lHZZ0CRcYu3SGVqAc0Hie45UQ5GR4gg1u4m/YgORvZ+2iAZKuaIq8FuJe AEJJ4jHg9XeBYCdfJm6sx338SBld+9NHTf0T2d1E= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 05 Oct 2018 12:54:45 +0530 From: Arun KS To: Michal Hocko Cc: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, boris.ostrovsky@oracle.com, jgross@suse.com, akpm@linux-foundation.org, dan.j.williams@intel.com, vbabka@suse.cz, iamjoonsoo.kim@lge.com, gregkh@linuxfoundation.org, osalvador@suse.de, malat@debian.org, kirill.shutemov@linux.intel.com, jrdr.linux@gmail.com, yasu.isimatu@gmail.com, mgorman@techsingularity.net, aaron.lu@intel.com, devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, xen-devel@lists.xenproject.org, vatsa@codeaurora.org, vinmenon@codeaurora.org, getarunks@gmail.com Subject: Re: [PATCH v4] memory_hotplug: Free pages as higher order In-Reply-To: <20181004145108.GH22173@dhcp22.suse.cz> References: <1538573979-28365-1-git-send-email-arunks@codeaurora.org> <20181004145108.GH22173@dhcp22.suse.cz> Message-ID: <9ed0de45f2d7257c56e39efe43606d27@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-10-04 20:21, Michal Hocko wrote: > On Wed 03-10-18 19:09:39, Arun KS wrote: > [...] >> +static int online_pages_blocks(unsigned long start, unsigned long >> nr_pages) >> +{ >> + unsigned long end = start + nr_pages; >> + int order, ret, onlined_pages = 0; >> + >> + while (start < end) { >> + order = min(MAX_ORDER - 1UL, __ffs(start)); >> + >> + while (start + (1UL << order) > end) >> + order--; > > this really made me scratch my head. Wouldn't it be much simpler to do > the following? > order = min(MAX_ORDER - 1, get_order(end - start))? Yes. Much better. Will change to, order = min(MAX_ORDER - 1, get_order(PFN_PHYS(end) - PFN_PHYS(start))); > >> + >> + ret = (*online_page_callback)(pfn_to_page(start), order); >> + if (!ret) >> + onlined_pages += (1UL << order); >> + else if (ret > 0) >> + onlined_pages += ret; >> + >> + start += (1UL << order); >> + } >> + return onlined_pages; >> } > [...] >> -static void __init __free_pages_boot_core(struct page *page, unsigned >> int order) >> +void __free_pages_core(struct page *page, unsigned int order) >> { >> unsigned int nr_pages = 1 << order; >> struct page *p = page; >> unsigned int loop; >> >> - prefetchw(p); >> - for (loop = 0; loop < (nr_pages - 1); loop++, p++) { >> - prefetchw(p + 1); >> + for (loop = 0; loop < nr_pages; loop++, p++) { >> __ClearPageReserved(p); >> set_page_count(p, 0); >> } >> - __ClearPageReserved(p); >> - set_page_count(p, 0); >> >> page_zone(page)->managed_pages += nr_pages; >> set_page_refcounted(page); > > I think this is wort a separate patch as it is unrelated to the patch. Sure. Will split the patch. Regards, Arun