From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D414FC4332B for ; Thu, 19 Mar 2020 14:02:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 54E1F208E4 for ; Thu, 19 Mar 2020 14:02:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="q7UfSe/x" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54E1F208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DCF666B0003; Thu, 19 Mar 2020 10:01:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D7F466B0005; Thu, 19 Mar 2020 10:01:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C95696B0006; Thu, 19 Mar 2020 10:01:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id B171F6B0003 for ; Thu, 19 Mar 2020 10:01:59 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5696940D6 for ; Thu, 19 Mar 2020 14:01:59 +0000 (UTC) X-FDA: 76612275558.12.angle06_4b7d75999984d X-HE-Tag: angle06_4b7d75999984d X-Filterd-Recvd-Size: 5755 Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Thu, 19 Mar 2020 14:01:58 +0000 (UTC) Received: by mail-qt1-f193.google.com with SMTP id l13so1812502qtv.10 for ; Thu, 19 Mar 2020 07:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=zI26wqa5aEpYDkabLs6lF79jALpaQpgQCRaGe0rAb3k=; b=q7UfSe/xw2kxQTUEkAej8462MqfU323vE3e2pP+VlGXnZwuJVSdhYFj+Yj/cawOF28 iE5GnZb/gHfvtBqXJTzG1sBnGIu/Si9ClU+bvRba3yM1OxXUylBhFGR8yb1HvgqM2W+T xlelStGIOPNQgDQIeDixYPKp1rbY8vyVGaQKeE9nANjtyoJFq8JDSKyvRhP6JtUcKIbR xVHLZdP6F/D80hPJpeJBLFvX0KgWBepwVk9njKdFvp37BmXztXGBjaNzs7ARXwlRUd7N HNDAmamF5fMBk7QYpAjQA8ML7Q9YyzIJG5t8ttvxIsuisO3eL+PGgPJG6Mjjx/tZkuWh pp8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=zI26wqa5aEpYDkabLs6lF79jALpaQpgQCRaGe0rAb3k=; b=cKjpNBC5SXnpU3gvfQgutTfWFcGPGS8Ge/lxdxX/jDbiH+8sJeODZM+BNs/5rM+XkG w+3L7UA0qfklPBoM4FpUmGVYbCPMlP9WXQ6otS77bBKrKRfBceR188HgnZENFoT0aH+V 1IGQzTt0HV+ad6qBFoGhgZMcR+84gH317VcPayZTEGLNejkyqVyoEZlz/HjmtiAKiObC ULUjK+Lb0Q2i1n1Q110Gh0iFRPACdkzOaYib0wDPrsDuSv/LLwf+c3nwEDPZ6AutaIzv 5IMjiGKn8dHOkhgPqrntJt7xxoM2GHJ/zlxFrVDjfC37wXjO4NYbObYAh0jWtuBFJk8y IhcQ== X-Gm-Message-State: ANhLgQ1uump2xUX676IJlCjTb8lmHrKJyXY6yL7GP2zvjNsdmbBevO0M HcsiMD+YBK7WyNDCjffE50d/ig== X-Google-Smtp-Source: ADFU+vvqSwO6Laoiqlw0Vb0ZWC3d9hwN2kFyKBXlgShZonLtCPb91pyqHWP2V0+l5Vq6xXh4LGz3sA== X-Received: by 2002:aed:2b83:: with SMTP id e3mr3004742qtd.361.1584626517415; Thu, 19 Mar 2020 07:01:57 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:a9a9]) by smtp.gmail.com with ESMTPSA id f16sm1653251qtk.61.2020.03.19.07.01.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 07:01:56 -0700 (PDT) Date: Thu, 19 Mar 2020 10:01:54 -0400 From: Johannes Weiner To: Yang Shi Cc: shakeelb@google.com, vbabka@suse.cz, willy@infradead.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [v4 PATCH 1/2] mm: swap: make page_evictable() inline Message-ID: <20200319140154.GB187654@cmpxchg.org> References: <1584500541-46817-1-git-send-email-yang.shi@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1584500541-46817-1-git-send-email-yang.shi@linux.alibaba.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000233, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Mar 18, 2020 at 11:02:20AM +0800, 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. > > Shakeel Butt did the below test: > > On a real machine with limiting the 'dd' on a single node and reading 100 GiB > sparse file (less than a single node). Just ran a single instance to not > cause the lru lock contention. The cmdline used is > "dd if=file-100GiB of=/dev/null bs=4k". 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 > > Fixes: 9c4e6b1a7027 ("mm, mlock, vmscan: no more skipping pagevecs") > Cc: Matthew Wilcox > Reviewed-and-Tested-by: Shakeel Butt > Acked-by: Vlastimil Babka > Signed-off-by: Yang Shi Acked-by: Johannes Weiner