Received: by 10.223.176.46 with SMTP id f43csp1083978wra; Wed, 24 Jan 2018 10:20:04 -0800 (PST) X-Google-Smtp-Source: AH8x2265Om+kYhO6AFA1JsUdLtcCKutwZHxKdGGuttAE2ix+AgMaJrqmRrcBnKlAPovIcr1e0L4U X-Received: by 2002:a17:902:a4:: with SMTP id a33-v6mr8508110pla.257.1516818004572; Wed, 24 Jan 2018 10:20:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516818004; cv=none; d=google.com; s=arc-20160816; b=jEni8yqzQSTbJE16is+ennmy4M+618Qlr8oc7QfCE0tUv41yCoxV3hKJ1HsBrcL2mR RYOk7YEi96Zw+UhLE9WHVuHBeSiv5qw8KzGcCBg8vhv98nQBh/0Le2dZnH2QI0/6b6Id w3Ecv0/o6YzlIb6AJqCJzyvoYqgthcLaoy78JXY2i5MbQyDO+BH05dvXBmTCrO8HAtJ/ S4ha2QALVdMJtmcdfGj0Dazu7aA7mvgUHL3nLT3tgr6iTuuBQwokdcpGg46cCK0lr0aM bk/6CdDq3IqoqXix39RMeql0Idc3xVc1apfkipH5RJgMZncdiSxNAiiqmFJ68Z3a2FUB LlSA== 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=P//Gh7MLpsiNfkF703yIrCaqCHgvyhh5kx58PTcWPzE=; b=ud40X59Es8DLkvFu3mIaiMA/JaTa1VpWhFaQiLD2wABcZcHOgY/0QtDRjg3kzlhngR k45C/lGAtxDDuqUqs1Hw7vCpe4uNTv/43kAxvIQ9FWxRUVw87pRIKxGMn7nOfyyuSmk4 JkUvo7ycvyhgGNQh0+nLP/xBvC4z6xRxiN2nB+RJMqlwDJn5Y5Y4BjBOr8lHwAJGcXov mjBujUOI01ji4EtQYK213c5nwPnUF1ScCK0hSQuC9AWANESSKQ2ryuOYK96/T/CNSmHj 0eHg/rSfVII2SvtWwprU+Y2CrIhZGhf82B/Gwzr46RU5LxQTbyItDsEd1vf1ZMuzGMon R6hw== 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 e71si428552pgc.295.2018.01.24.10.19.50; Wed, 24 Jan 2018 10:20:04 -0800 (PST) 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 S965032AbeAXSTY (ORCPT + 99 others); Wed, 24 Jan 2018 13:19:24 -0500 Received: from outbound-smtp20.blacknight.com ([46.22.139.247]:59637 "EHLO outbound-smtp20.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964953AbeAXSTX (ORCPT ); Wed, 24 Jan 2018 13:19:23 -0500 Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp20.blacknight.com (Postfix) with ESMTPS id ADB331C38F6 for ; Wed, 24 Jan 2018 18:19:21 +0000 (GMT) Received: (qmail 625 invoked from network); 24 Jan 2018 18:19:21 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[37.228.237.61]) by 81.17.254.9 with ESMTPSA (DHE-RSA-AES256-SHA encrypted, authenticated); 24 Jan 2018 18:19:21 -0000 Date: Wed, 24 Jan 2018 18:19:21 +0000 From: Mel Gorman To: Dave Hansen Cc: Aaron Lu , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Huang Ying , Kemi Wang , Tim Chen , Andi Kleen , Michal Hocko , Vlastimil Babka Subject: Re: [PATCH 2/2] free_pcppages_bulk: prefetch buddy while not holding lock Message-ID: <20180124181921.vnivr32q72ey7p5i@techsingularity.net> References: <20180124023050.20097-1-aaron.lu@intel.com> <20180124023050.20097-2-aaron.lu@intel.com> <20180124164344.lca63gjn7mefuiac@techsingularity.net> <148a42d8-8306-2f2f-7f7c-86bc118f8ccd@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <148a42d8-8306-2f2f-7f7c-86bc118f8ccd@intel.com> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 24, 2018 at 08:57:43AM -0800, Dave Hansen wrote: > On 01/24/2018 08:43 AM, Mel Gorman wrote: > > I'm less convinced by this for a microbenchmark. Prefetch has not been a > > universal win in the past and we cannot be sure that it's a good idea on > > all architectures or doesn't have other side-effects such as consuming > > memory bandwidth for data we don't need or evicting cache hot data for > > buddy information that is not used. > > I had the same reaction. > > But, I think this case is special. We *always* do buddy merging (well, > before the next patch in the series is applied) and check an order-0 > page's buddy to try to merge it when it goes into the main allocator. > So, the cacheline will always come in. > > IOW, I don't think this has the same downsides normally associated with > prefetch() since the data is always used. That doesn't side-step the calculations are done twice in the free_pcppages_bulk path and there is no guarantee that one prefetch in the list of pages being freed will not evict a previous prefetch due to collisions. At least on the machine I'm writing this from, the prefetches necessary for a standard drain are 1/16th of the L1D cache so some collisions/evictions are possible. We're doing definite work in one path on the chance it'll still be cache-resident when it's recalculated. I suspect that only a microbenchmark that is doing very large amounts of frees (or a large munmap or exit) will notice and the costs of a large munmap/exit are so high that the prefetch will be negligible savings. -- Mel Gorman SUSE Labs