Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp203248imm; Tue, 19 Jun 2018 19:18:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIrE5XjLtblQtje9YW+YEnEAoDZqT+t89ScpC3w8epXFRNb4FPKnycGk8b66DRQBIgMsAPS X-Received: by 2002:a62:8d5:: with SMTP id 82-v6mr20778183pfi.154.1529461106977; Tue, 19 Jun 2018 19:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529461106; cv=none; d=google.com; s=arc-20160816; b=Oh50NNvdQ/Do4yMMiieWbkl6663XsNx6EIns9XXqPdyYAAKxZTisGpSSjOC65hGUFu rQCis/+t7kMqzD60byjiGyjqHmGqG3vOpLtGwL7n/WohY5Uh8WXfuTpXcI/L1/bJ0/P4 VcLYofXdkFwe6pLMVPAfjHvgkx6UhMuGPrvEj4hPSsUFlgS8h67Zyu/qt0qpH24jyafG jOOVOYGNLQzrmy+/8RRuDCkH9LEHAt1sI4GDPBRGfKkNkw2Ve8iUG501CEDWZfITRiWI cTdSeYDDHnkbaeNV7wHVk8RItYZZKCaVIKPZiuXL+lJAyr/fMFuUGDu9df+wMRCXNZmI 2zcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :arc-authentication-results; bh=zjH6vcw5y2Q4HB/sXWIZI6aFZ1m+wcAU22daVb8T1rw=; b=UlbIOK/jGj+7t2nuHSLTeMFZuJo5QZbhnYZ+zIJRDkxvc6vEPCt7qnFM9OuzYqZTlg KfFY61BnAxq17Uh8pTwo5vivOtm4c+2rUAuCtMOf7nHvDEb9ldnsyBCvbUqzS+X6HhZ7 Ecu7b/yUclot0X31zpeeqdoIfUPpu5H33VVgdeEw962kGpiwEjpezAX0/OAy1zt0KbU7 P5ap/fw9KvW0N1A0mEoKn9wggW4S0nbiNF1TILGPb0zqeGohfLATjDJP8Q0jyylXM5La lMOSrNR1WCmhWNQifFStlSRjxkUjru9MdMNyX09Nn+wyVFxl+LS4XA+dB//QdHNJuAaj Jt4g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l14-v6si1038486pgs.155.2018.06.19.19.18.12; Tue, 19 Jun 2018 19:18:26 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754106AbeFTCRd convert rfc822-to-8bit (ORCPT + 99 others); Tue, 19 Jun 2018 22:17:33 -0400 Received: from tyo161.gate.nec.co.jp ([114.179.232.161]:56942 "EHLO tyo161.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753758AbeFTCRc (ORCPT ); Tue, 19 Jun 2018 22:17:32 -0400 Received: from mailgate02.nec.co.jp ([114.179.233.122]) by tyo161.gate.nec.co.jp (8.15.1/8.15.1) with ESMTPS id w5K2FjIr016628 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 20 Jun 2018 11:15:45 +0900 Received: from mailsv02.nec.co.jp (mailgate-v.nec.co.jp [10.204.236.94]) by mailgate02.nec.co.jp (8.15.1/8.15.1) with ESMTP id w5K2FjkZ008492; Wed, 20 Jun 2018 11:15:45 +0900 Received: from mail01b.kamome.nec.co.jp (mail01b.kamome.nec.co.jp [10.25.43.2]) by mailsv02.nec.co.jp (8.15.1/8.15.1) with ESMTP id w5K2CsV7017583; Wed, 20 Jun 2018 11:15:45 +0900 Received: from bpxc99gp.gisp.nec.co.jp ([10.38.151.148] [10.38.151.148]) by mail02.kamome.nec.co.jp with ESMTP id BT-MMP-1335395; Wed, 20 Jun 2018 11:14:54 +0900 Received: from BPXM23GP.gisp.nec.co.jp ([10.38.151.215]) by BPXC20GP.gisp.nec.co.jp ([10.38.151.148]) with mapi id 14.03.0319.002; Wed, 20 Jun 2018 11:14:53 +0900 From: Naoya Horiguchi To: Pavel Tatashin CC: "steven.sistare@oracle.com" , "daniel.m.jordan@oracle.com" , "akpm@linux-foundation.org" , "linux-kernel@vger.kernel.org" , "mhocko@suse.com" , "linux-mm@kvack.org" , "osalvador@suse.de" , "willy@infradead.org" , "mingo@kernel.org" , "dan.j.williams@intel.com" , "ying.huang@intel.com" Subject: Re: [PATCH] mm: skip invalid pages block at a time in zero_resv_unresv Thread-Topic: [PATCH] mm: skip invalid pages block at a time in zero_resv_unresv Thread-Index: AQHUBMGZzpEnEUsumkebRnt6zmuZMaRn2I4A Date: Wed, 20 Jun 2018 02:14:53 +0000 Message-ID: <20180620021452.GA7241@hori1.linux.bs1.fc.nec.co.jp> References: <20180615155733.1175-1-pasha.tatashin@oracle.com> In-Reply-To: <20180615155733.1175-1-pasha.tatashin@oracle.com> Accept-Language: en-US, ja-JP Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.51.8.80] Content-Type: text/plain; charset="iso-2022-jp" Content-ID: <5C4BEA7B6AF786479FE83EE4EF287E8D@gisp.nec.co.jp> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-TM-AS-MML: disable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 15, 2018 at 11:57:33AM -0400, Pavel Tatashin wrote: > The role of zero_resv_unavail() is to make sure that every struct page that > is allocated but is not backed by memory that is accessible by kernel is > zeroed and not in some uninitialized state. > > Since struct pages are allocated in blocks (2M pages in x86 case), we can > skip pageblock_nr_pages at a time, when the first one is found to be > invalid. > > This optimization may help since now on x86 every hole in e820 maps > is marked as reserved in memblock, and thus will go through this function. > > This function is called before sched_clock() is initialized, so I used my > x86 early boot clock patches to measure the performance improvement. > > With 1T hole on i7-8700 currently we would take 0.606918s of boot time, but > with this optimization 0.001103s. > > Signed-off-by: Pavel Tatashin Looks good to me, thanks! Reviewed-by: Naoya Horiguchi > --- > mm/page_alloc.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 1521100f1e63..94f1b3201735 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -6404,8 +6404,11 @@ void __paginginit zero_resv_unavail(void) > pgcnt = 0; > for_each_resv_unavail_range(i, &start, &end) { > for (pfn = PFN_DOWN(start); pfn < PFN_UP(end); pfn++) { > - if (!pfn_valid(ALIGN_DOWN(pfn, pageblock_nr_pages))) > + if (!pfn_valid(ALIGN_DOWN(pfn, pageblock_nr_pages))) { > + pfn = ALIGN_DOWN(pfn, pageblock_nr_pages) > + + pageblock_nr_pages - 1; > continue; > + } > mm_zero_struct_page(pfn_to_page(pfn)); > pgcnt++; > } > -- > 2.17.1 > >