Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3247046ybh; Mon, 16 Mar 2020 19:07:39 -0700 (PDT) X-Google-Smtp-Source: ADFU+vskjZLLyllFoNJQDxt8gNv67Jn/63W516NE9/xqvFq+VfS2/loT9kB8V0BS2FdIx075sLkv X-Received: by 2002:aca:3386:: with SMTP id z128mr1673274oiz.40.1584410859062; Mon, 16 Mar 2020 19:07:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584410859; cv=none; d=google.com; s=arc-20160816; b=Hx3zRLA4xhtVw+AK3skcNE4n0RfQ8jWCbeDS5evkUSvBecWaEU6MkqRTPbSfAFztPi KfSF72FhXbsPaIotY1l79ZgbOy9n7q69R0DA7KkpEGW7qZ8he9nlKgcPrRRYTr8F8ZHs pidv8d1aC85PbMs2aIQZ8WLaobvxFVVs1k7MRJ6sDtMnVLYEICyFQNP7xjXFpNi1lAGx /TSJMKHEIDMkxVcepiVGUFAbhqDagtjDOQWO4u3Z25ivmSLnAzZbLRhaIHvVk5smzxb3 dHRjNP9un93wf+HxnJa4q5hYgiFRRMczZWDFM5ykfFsI7OWIVqWQr8m0VZhSyI30S7ve 0Gmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=DZ0dMziz9dLyXGZhFuKBUpXFtLVLigh3YFyxztzLpbQ=; b=PBl7JtYgewWDgl6gVyc0jxDL5+AAhEdOSpzw3+ausbdYG9mLyqB/qIXWIemfzdheFq 1Q4ej8v/QGsSyQ4RytvS2o1XvblR3ODdz41i5hXuplIaKRLyDe15XzMs3OGh4fePYYNJ fIQw0/m0ufCAWTfUrHtCB5/XJeP4VOMerKFD7zC2p+PmUzyxDleS78D33xOUQXLxdtX8 roTYmBx5qD6oB840JWRQbRVqf/3dQKQJyXJgoRrJ/DCqllRZsTaqegq7SKCRcZl6FBs8 rcS7c43wPmV4YNTbZzAJwMnwh5VZeMftiOV0Eoqy55d93tPfeRAv36ot46T2KncSVOtK 2Y7w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q137si935929oic.139.2020.03.16.19.07.26; Mon, 16 Mar 2020 19:07:39 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726121AbgCQCHK (ORCPT + 99 others); Mon, 16 Mar 2020 22:07:10 -0400 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:46833 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725837AbgCQCHJ (ORCPT ); Mon, 16 Mar 2020 22:07:09 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07488;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0Tsp8nCr_1584410758; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0Tsp8nCr_1584410758) by smtp.aliyun-inc.com(127.0.0.1); Tue, 17 Mar 2020 10:06:00 +0800 Subject: Re: [v2 PATCH 1/2] mm: swap: make page_evictable() inline To: Shakeel Butt Cc: Vlastimil Babka , Matthew Wilcox , Andrew Morton , Linux MM , LKML References: <1584397455-28701-1-git-send-email-yang.shi@linux.alibaba.com> From: Yang Shi Message-ID: Date: Mon, 16 Mar 2020 19:05:58 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/16/20 4:46 PM, Shakeel Butt wrote: > On Mon, Mar 16, 2020 at 3: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 > > So, I tested on a real machine with limiting the 'dd' on a single node > and reading 100 GiB sparse file (less than a single node). I just ran > a single instance to not cause the lru lock contention. The cmd I used > is "dd if=file-100GiB of=/dev/null bs=4k". I ran the cmd 10 times with > drop_caches in between and measured the time it took. > > Without patch: 56.64143 +- 0.672 sec > > With patches: 56.10 +- 0.21 sec > > Reviewed-and-Tested-by: Shakeel Butt Thanks Shakeel. It'd better to add your test result in the commit log too.