Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1101126imm; Fri, 15 Jun 2018 11:11:59 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK9fbw39zCA64rKkT0C24TN4KcXW/wkMYZ/zfKUraEChRTSyQPS3d/xXDF/JeXbQlxb5qM/ X-Received: by 2002:a62:8a0a:: with SMTP id y10-v6mr3070790pfd.237.1529086319093; Fri, 15 Jun 2018 11:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529086319; cv=none; d=google.com; s=arc-20160816; b=Gsnzx5BaaYXOP8YxSPW+7CW3RiDQTjLSQaYAi66hdezjp8q0lhBPD5xZNoY0Nlw0bj 2ZkoEEDLKAuALR/8enKmHHZIMdo7fAuUioknMT0wkUBRSzXq/1bZdZYWGUd76yPm7P1/ 7aqZ5LdE8uim85g1W6tyZnsM/tVLfqMVrMQWg+SJJ+XArxycB0OTEq7OhFAY5Qtbfi40 6pCa03X6CvTe2vpUUxr7N+1+2UswQT7ccbza191UJcYDl09EXSAHr2Q02IDJb3ymS2zA G6d4I9VsKGv34bblf6idsfa/SKhWLCo1SrHaatTOL/ZNDw1zt82yyK6+0K03M0nf2xbg oYAA== 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:arc-authentication-results; bh=kIhPURL6ey1eznLXSt4y9mijU+BGtrO1E8mfaP1GJ+Q=; b=aGLUB6fIDuqFFhhyw6kTlbUg66D9QADbUQlW1na0ADgwd5Eb+Y23l2axZS2MviUsjM xK1Oj8LmQuWzEwosRLMlVoNSLhwdNPgydMazZ+7uyx9X2zZaiPd2LNQ8WpWmly+pQx88 f/MJwfK0S9dCji4CfwOJmP2C8WTXOwsqOOqIhcWinF+82JzU00fqtOnq3JvA5QMbBg1E NFcyBOhAtY/PNWH36bPRiQ/4yjp2bZ4hVvjmMWYcpqXpAwSba3NwNDLOVKSXeiHC8OdR +oMfYTnvOvZxIhiSzfWSZItXXTiMFlWdmQ9NSQ/rI5nnv2sptakFmqHYX0MclkTHGz6z snWQ== 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 63-v6si1567211plb.515.2018.06.15.11.11.43; Fri, 15 Jun 2018 11:11:59 -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 S1756299AbeFOSLR (ORCPT + 99 others); Fri, 15 Jun 2018 14:11:17 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:50356 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753951AbeFOSLQ (ORCPT ); Fri, 15 Jun 2018 14:11:16 -0400 Received: by mail-wm0-f65.google.com with SMTP id e16-v6so4863988wmd.0 for ; Fri, 15 Jun 2018 11:11:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kIhPURL6ey1eznLXSt4y9mijU+BGtrO1E8mfaP1GJ+Q=; b=Tp5kcd/7drmmROeL2V/87pn6BwddRvsTsOAfEeAlkGUxISaZ6pd4KOY6+fT+ge67sZ iprANNX0kauk0h9BPu1n4BidvAT3y/iK7Q40PEY4Fb2jZLoHztYuYIm8QLLvy1pUIt4q bTVxWP4rAyu5sWOfVQJq66AVrrBbudxvYI4iHqgxq49wveNDScuCCuL2QFZkhYWW9a5q 4hr+Uv6Y/UFbB4nH7BZan6+HaPJO9/SOl4aOSpvPOhQhCtjN/eknjg3ZW4+JAeE3zqT4 rM+9/nvaUYgkNQk3Tc9XVu6mpPt8MMkGqknEx/RwDgBfEkIWaeNhKOH8TRTNDnPzogQ5 /bmA== X-Gm-Message-State: APt69E1GanCCTgg5HffYm1NQWAHqoAZRyVZN8ULbyADfsbnCVcbQTS/K USea67ve/m1Lc9mXU6/4t/w= X-Received: by 2002:a1c:7d56:: with SMTP id y83-v6mr2191154wmc.65.1529086274919; Fri, 15 Jun 2018 11:11:14 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id l41-v6sm13986564wre.87.2018.06.15.11.11.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jun 2018 11:11:14 -0700 (PDT) Received: by techadventures.net (Postfix, from userid 1000) id 1385512350E; Fri, 15 Jun 2018 20:11:13 +0200 (CEST) Date: Fri, 15 Jun 2018 20:11:13 +0200 From: Oscar Salvador 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, n-horiguchi@ah.jp.nec.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 Message-ID: <20180615181113.GA27558@techadventures.net> References: <20180615155733.1175-1-pasha.tatashin@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180615155733.1175-1-pasha.tatashin@oracle.com> User-Agent: Mutt/1.5.23 (2014-03-12) 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 > --- > 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++; > } Hi Pavel, Thanks for the patch. This looks good to me. Reviewed-by: Oscar Salvador > -- > 2.17.1 > Best Regards Oscar Salvador