Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3542249ybh; Tue, 17 Mar 2020 02:01:03 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvQcgtoNZnGSqAMpFQ3/KCsKF85XkurvpSLCrDpoCNxNYe1yl6To2jho9OSz/0z3ec4aboy X-Received: by 2002:a05:6830:60e:: with SMTP id w14mr3049894oti.22.1584435663086; Tue, 17 Mar 2020 02:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584435663; cv=none; d=google.com; s=arc-20160816; b=iebhbuVXv6nz3z45R0x7BTyqiz2TUILDYaFHdJPI42LZa1KaguRtFWRQtcsOJmWsyA WB94qjj/T6IoP9rlwpKuMrMSi5cZa+HCzBtAnn/4gdM6UXW6Qv36zMnOWO3sbMpu8OLX 6wk2Vrurji/whwK45A0WaPgV0mcgxnTTTI3ej4+2LfldaXqRZhHm26ZcTeoWkxC5iNoe jD+84n1sp8w1iuDDv/K8ceo/NxLDSauEI1iDXx27mg2cuKVaIOl7/eVBDAt297HO6Ucq dCxJkFUR7lscifGSeaHa5lEagmgvxOg2Of6esi3gOBPMcxvBJrXdmRmUZzM6tCpAOd3A ltvA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=xFwy/5bTBSXQ3XUNXx5oDEwbfCiVN34g1y9PVQzRBSM=; b=Fd+c9BxeE+OdukLu/7xe2OwAZfrX1yN1EjsmaoFOuI2wmz4OU+WEK5sOmcK+DtIC27 Xzqo+MPbsYOkGSvExqReC/rc6kEG+zprzu18FrRNRQaSV3Qh550FLr2JvkUBVis6Ixe6 hw+cbcSPo0WtXQS1HLaA8zkpzq9mrKbDbZ1fO2wM75hcrUOfOI1OnrrMfIPwfPqf5dQn IJ9tBJgucxcD3DbmnN6oqUa9t2Du1RLx8Ic3igxH9chrC04MOWNGhayF4qGHc5fcuen3 1QUGMVFrrPlWoI/dn9WTZbJon1tGuFWWTtVs2i6b091QnTFSu4YRAgcgc3r8EnSIyAgG VBwQ== 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 i132si921544oih.249.2020.03.17.02.00.49; Tue, 17 Mar 2020 02:01:03 -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 S1726082AbgCQI7I (ORCPT + 99 others); Tue, 17 Mar 2020 04:59:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:42634 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725536AbgCQI7H (ORCPT ); Tue, 17 Mar 2020 04:59:07 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CABB1AEC7; Tue, 17 Mar 2020 08:59:05 +0000 (UTC) Subject: Re: [v2 PATCH 1/2] mm: swap: make page_evictable() inline To: Yang Shi , shakeelb@google.com, willy@infradead.org, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <1584397455-28701-1-git-send-email-yang.shi@linux.alibaba.com> From: Vlastimil Babka Message-ID: Date: Tue, 17 Mar 2020 09:59:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <1584397455-28701-1-git-send-email-yang.shi@linux.alibaba.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/16/20 11:24 PM, Yang Shi wrote: > When backporting commit 9c4e6b1a7027 ("mm, mlock, vmscan: no more > skipping pagevecs") to our 4.9 kernel, our test bench noticed around 10% > down with a couple of vm-scalability's test cases (lru-file-readonce, > lru-file-readtwice and lru-file-mmap-read). I didn't see that much down > on my VM (32c-64g-2nodes). It might be caused by the test configuration, > which is 32c-256g with NUMA disabled and the tests were run in root memcg, > so the tests actually stress only one inactive and active lru. It > sounds not very usual in mordern production environment. > > That commit did two major changes: > 1. Call page_evictable() > 2. Use smp_mb to force the PG_lru set visible > > It looks they contribute the most overhead. The page_evictable() is a > function which does function prologue and epilogue, and that was used by > page reclaim path only. However, lru add is a very hot path, so it > sounds better to make it inline. However, it calls page_mapping() which > is not inlined either, but the disassemble shows it doesn't do push and > pop operations and it sounds not very straightforward to inline it. > > Other than this, it sounds smp_mb() is not necessary for x86 since > SetPageLRU is atomic which enforces memory barrier already, replace it > with smp_mb__after_atomic() in the following patch. > > With the two fixes applied, the tests can get back around 5% on that > test bench and get back normal on my VM. Since the test bench > configuration is not that usual and I also saw around 6% up on the > latest upstream, so it sounds good enough IMHO. > > The below is test data (lru-file-readtwice throughput) against the v5.6-rc4: > mainline w/ inline fix > 150MB 154MB > > With this patch the throughput gets 2.67% up. The data with using > smp_mb__after_atomic() is showed in the following patch. > > Fixes: 9c4e6b1a7027 ("mm, mlock, vmscan: no more skipping pagevecs") > Cc: Shakeel Butt > Cc: Vlastimil Babka > Cc: Matthew Wilcox > Signed-off-by: Yang Shi Acked-by: Vlastimil Babka Thanks.