Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp51335ybg; Tue, 9 Jun 2020 16:06:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywFYP7cm+euO4MDNB3MBmtK8Hj+6wCFASkJWTwVCh1ll7F9ayqVCzdSI29l8LSWsomzXm/ X-Received: by 2002:a17:906:e257:: with SMTP id gq23mr613097ejb.398.1591743965116; Tue, 09 Jun 2020 16:06:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591743965; cv=none; d=google.com; s=arc-20160816; b=rV3ZvZvqkLVp2Y+Otc8EGkyQsbXtC6K80D7sRFeMaMuWeEvFv79QUX66liVys4vd4B TpvrorUiPY/g6UGUSlKll9tQ+J8ACYgQNCtwcRXnDwoxdy1Hd66ygZia4ToB3LRhJwOB dA0PzvphfcptzkAdbump8aVJDTTiPPOaikc/14d5eVqBe3yurZZxVrZbWfoMTgygZzQB j7aIO4oGOW/Tjd3O2qKsT8EYHJgSy3/TYjZrgtdC9sqaxuZCs+BwDekweQR4/LEPOpRf n9XIO86xP98wZ3IyRDQpcdmTlTvHmuiN61U11jZ44Fil6bo0fTB2MGu+DKcOMitLc7FH z+bA== 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:dkim-signature; bh=MGVZvDqcuMlZe++v/Ety2bhMoDiErGWUbymYlqHLHGQ=; b=sw5fF7r9JT8xmI47QeFatJA71j2slTKhb5jOWSDafmvWyRQiMta1ZOac/mhQiZOthV Dr+GpZGseRqs3KkJjg0rUYKSRD48UnY2tAcNYFQeOUAOBHPIn0sga3tOUrjGsJqKa6Xv mBRpqkJ7COUoO2KTkl/EesQzf6K+PlIAr+vHxDJWidjhaEFhKarCzC8LFWkZu5F7bV7D 6EG15NMZtWvdNASV2h3Q6Z4EfZdLWJ9BB2Cg3AftiNeYQxWoRdC8fJzno23RSpLWqJRX Obx1FxCG9Nt7XHPHcLlgtZe6kRSq9wN0iwSzgrosinRc9dp7+RvMk9lhV2is7W1RzBgf pOwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=SNfXRCcb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 30si12771134edr.262.2020.06.09.16.05.28; Tue, 09 Jun 2020 16:06:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=SNfXRCcb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728994AbgFIXDd (ORCPT + 99 others); Tue, 9 Jun 2020 19:03:33 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:48798 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728108AbgFIXDd (ORCPT ); Tue, 9 Jun 2020 19:03:33 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 059N33L0169324; Tue, 9 Jun 2020 23:03:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=MGVZvDqcuMlZe++v/Ety2bhMoDiErGWUbymYlqHLHGQ=; b=SNfXRCcbGGUvlE2cFIKylsz7QSj+rJf/ofo8qKfbozqhBtkypKxAnGNGb31nfwvLyW77 q9WuPxRtn/WJViDi/BtkMXNPZYzOJCpsEuijE890as/y2RZBTuWdi/rmLFQiMu7NAGbF RH3Z0V9I5T5i4U8jSaSsvsGmE/hHFzvvEcNoPdsYKbrE2YpuShh76utfBxJ6EN/E9EaH n5kEvQI+1KzR44Nu1v4PlXTC+hDOseR/2y1zZIA+Mtk3VQmezFKhgm7sI4eegLiGvX4Y JxEDmc+/yEjZSKOA5EK5nwSV8feTiUnIdM3E5cwe9zmCbjyJORwEByljL57AGHVgrihH Xw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 31jepnsbgc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 09 Jun 2020 23:03:23 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 059MrsGX027095; Tue, 9 Jun 2020 23:03:22 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 31gmqp901a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 09 Jun 2020 23:03:22 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 059N3Lru029897; Tue, 9 Jun 2020 23:03:21 GMT Received: from ca-dmjordan1.us.oracle.com (/10.211.9.48) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 09 Jun 2020 16:03:20 -0700 Date: Tue, 9 Jun 2020 19:03:45 -0400 From: Daniel Jordan To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , Andy Lutomirski , Dave Hansen , David Hildenbrand , Michal Hocko , Pavel Tatashin , Peter Zijlstra , Steven Sistare , Daniel Jordan Subject: Re: [PATCH v2] x86/mm: use max memory block size on bare metal Message-ID: <20200609230345.bq6jstgpvu63vbwo@ca-dmjordan1.us.oracle.com> References: <20200609225451.3542648-1-daniel.m.jordan@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200609225451.3542648-1-daniel.m.jordan@oracle.com> User-Agent: NeoMutt/20180716 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9647 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006090173 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9647 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 phishscore=0 impostorscore=0 malwarescore=0 mlxscore=0 cotscore=-2147483648 adultscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006090174 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 09, 2020 at 06:54:51PM -0400, Daniel Jordan wrote: > Some of our servers spend significant time at kernel boot initializing > memory block sysfs directories and then creating symlinks between them > and the corresponding nodes. The slowness happens because the machines > get stuck with the smallest supported memory block size on x86 (128M), > which results in 16,288 directories to cover the 2T of installed RAM. > The search for each memory block is noticeable even with > commit 4fb6eabf1037 ("drivers/base/memory.c: cache memory blocks in > xarray to accelerate lookup"). > > Commit 078eb6aa50dc ("x86/mm/memory_hotplug: determine block size based > on the end of boot memory") chooses the block size based on alignment > with memory end. That addresses hotplug failures in qemu guests, but > for bare metal systems whose memory end isn't aligned to even the > smallest size, it leaves them at 128M. > > Make kernels that aren't running on a hypervisor use the largest > supported size (2G) to minimize overhead on big machines. Kernel boot > goes 7% faster on the aforementioned servers, shaving off half a second. > > Signed-off-by: Daniel Jordan > Cc: Andrew Morton > Cc: Andy Lutomirski > Cc: Dave Hansen > Cc: David Hildenbrand > Cc: Michal Hocko > Cc: Pavel Tatashin > Cc: Peter Zijlstra > Cc: Steven Sistare > Cc: linux-mm@kvack.org > Cc: linux-kernel@vger.kernel.org > --- Forgot the v1 changes: - Thanks to David for the idea to make this conditional based on virtualization. - Update performance numbers to account for 4fb6eabf1037 (David)