Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1087489ybt; Fri, 26 Jun 2020 20:49:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVgIDQQ8F212y4mdRtQsWfLlqZlkLIPRl4ST6a8ENxpfsI+qtcBX4INLC/MBu4PwBMNKez X-Received: by 2002:a17:907:9484:: with SMTP id dm4mr5580007ejc.56.1593229792526; Fri, 26 Jun 2020 20:49:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593229792; cv=none; d=google.com; s=arc-20160816; b=FjI5Osd/IFnOWt7FJvVuaKNaHYBug3S4bBLFw8vwHCu04nIJ7DBg48GhhIt1dKIubb zLchWcf3GRzgeeMnRHBLHbcZQgNlGCGqRO/3Wnz9xCtanpNkzk0CxsamJyH5KUUoASZW ODu7IfJ6AshAhEAJREtq/1djYVAIvjPRaeOlwtiR2liX6ikKSoSbE9KX+i7wXMdFlltv F09HiCJpF1KDgA3iZlq9hI13KQjtsdF8RVmmS1NoPwUrOGUrd3AjXdIu9/BlCl8kK605 KbeU+vkUiMmDGzy4XSF0OnueXZwsiX4Hho7np5w51yghAbQJLG6gR1UNldA2pi8ghPfF W6QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=nFE+2golEe43L01jJnqBmyl9Tx9OQwKr6C+46YbBF5Q=; b=Xz6sORxrvOg8mXzn/t8KLEYBoT8xy4M0uDzdxQy+zcM02YyFoQsYZZRqg2o8ockCFi HEO7niMjRY1qb8eoXB7QGs+8ZIe4MupFXfTRXGo6KBLBL4c+UtZ6vUoM3BADOjNzXgfy gDvcuJ7+OO+wwjh+NRe7Xns7br0LCa+OuEXidwpEhha2aeJuiBRsHbYrqcvGDHVuYYUm xAhVOtMpIF1hA8hvp1d0Q8UgpQxfHh+AXEmi8mbRfIjeqSKp/HH4w1+CsYb8RIdpHu7O UPfOeY+E4/hWjc2DdZPDU0zCMDBV72x+KMKgXhinLyWz35nq1BoFhbaidM1v3GwsVNFp pxSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bUr8sMsx; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t12si3736177ejr.551.2020.06.26.20.49.27; Fri, 26 Jun 2020 20:49:52 -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=@kernel.org header.s=default header.b=bUr8sMsx; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725867AbgF0DrG (ORCPT + 99 others); Fri, 26 Jun 2020 23:47:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:47322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725828AbgF0DrF (ORCPT ); Fri, 26 Jun 2020 23:47:05 -0400 Received: from X1 (nat-ab2241.sltdut.senawave.net [162.218.216.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E39712073E; Sat, 27 Jun 2020 03:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593229625; bh=7M/aFJ4oCOEcKIXVhUAL7PKvd2xl0X++eFKfo6b95LY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=bUr8sMsxHrVrBaccYyd85cCqLAtEnJmUNoxmm8PZWhwZHcc1jK7BN4eRWytH9bhos OmlGTTxNjjajBsmYLsSq7wQIeFy3Q+XzmFVun188tt8rZHUzX0XziHzXUHD6TPRkYX 9Lv0CH1dAtiKWACeliqstPy+PlbMQcAC2ldm8GnQ= Date: Fri, 26 Jun 2020 20:47:04 -0700 From: Andrew Morton To: Matthew Wilcox Cc: Tim Chen , Vladimir Davydov , Johannes Weiner , Michal Hocko , Dave Hansen , Ying Huang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [Patch] mm: Increase pagevec size on large system Message-Id: <20200626204704.f023988699421db00e9bdab7@linux-foundation.org> In-Reply-To: <20200627031304.GC25039@casper.infradead.org> References: <20200627031304.GC25039@casper.infradead.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 27 Jun 2020 04:13:04 +0100 Matthew Wilcox wrote: > On Fri, Jun 26, 2020 at 02:23:03PM -0700, Tim Chen wrote: > > Enlarge the pagevec size to 31 to reduce LRU lock contention for > > large systems. > > > > The LRU lock contention is reduced from 8.9% of total CPU cycles > > to 2.2% of CPU cyles. And the pmbench throughput increases > > from 88.8 Mpages/sec to 95.1 Mpages/sec. > > The downside here is that pagevecs are often stored on the stack (eg > truncate_inode_pages_range()) as well as being used for the LRU list. > On a 64-bit system, this increases the stack usage from 128 to 256 bytes > for this array. > > I wonder if we could do something where we transform the ones on the > stack to DECLARE_STACK_PAGEVEC(pvec), and similarly DECLARE_LRU_PAGEVEC > the ones used for the LRUs. There's plenty of space in the header to > add an unsigned char sz, delete PAGEVEC_SIZE and make it an variable > length struct. > > Or maybe our stacks are now big enough that we just don't care. > What do you think? And I wonder how useful CONFIG_NR_CPUS is for making this decision. Presumably a lot of general-purpose kernel builds have CONFIG_NR_CPUS much larger than the actual number of CPUs. I can't think of much of a fix for this, apart from making it larger on all kernels, Is there a downside to this?