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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 11FAFC433B4 for ; Wed, 19 May 2021 03:17:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 866BD6135B for ; Wed, 19 May 2021 03:17:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 866BD6135B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B94C26B00EF; Tue, 18 May 2021 23:17:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B6C896B00FC; Tue, 18 May 2021 23:17:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A33F16B0118; Tue, 18 May 2021 23:17:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id 741326B00EF for ; Tue, 18 May 2021 23:17:41 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0DD09180ACF6C for ; Wed, 19 May 2021 03:17:41 +0000 (UTC) X-FDA: 78156520722.07.78A6468 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by imf12.hostedemail.com (Postfix) with ESMTP id 90F25798 for ; Wed, 19 May 2021 03:17:39 +0000 (UTC) Received: by mail-lf1-f47.google.com with SMTP id q7so15493417lfr.6 for ; Tue, 18 May 2021 20:17:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hxNVQPiC8fzbxLiyAUu9bsx0HZLll8xQ7nokNM1IEpE=; b=efD+mqUpjR1dd0ERhmnuJ8hRRDA/3RqzPWiqZBAtCryCyZaUtomUS3IfTkjeOIA9UX vBYuvUtTNGWnCphyRb0vD9f00gYJMkWS0ezJAJrKjSGqpbyYVJDj/iFthwRLa6uFHtLg KLBoPW3UfdmH/fKmEoIQyq87033h4rdkRyBYw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hxNVQPiC8fzbxLiyAUu9bsx0HZLll8xQ7nokNM1IEpE=; b=BszEnMfnZWVtVgHwXG4VCYQRp8mlJgRN5D4GR+R2Fkq3ruDbi1iplUmrFe2xi63mMo cTq7IA5VTdnSL09s1CzohSkzbzkJFxarT6skmRT39hPaXYwgj3hmlCgVE3l/Vsfd2luh OarlbSnF986BRX9npJzC7lyvU1OZCo9MYOV/TP9i6hUVUnBs3DGTcL8Ort+R+qDDHk0c uhCqgQHG967DS5h1jyRcPqF+AhmIkNEKf/MJC3c2vM+3FatySSS+oIL3gd6zF0GjQ04+ 2MzrnubWnrxaqMm7nlhGDIwboGF0jp73fj+KhrfnqiL3OcljvxU5kVp5jlSuvxqYLNLc TmRQ== X-Gm-Message-State: AOAM532mSLyoBNJK7ARCk6cKxau8F3wEeefJFAHZsqxcrQsGqEdhln// WwJbmgoGy9AjhF2Zyc6p5Fmf3FR4tfzzxXgWU2g= X-Google-Smtp-Source: ABdhPJwmpjD40o6TtJX0V+Akz2rNXJTi8QgU9TahnyAtdL64lAT7ruoI/+JKxCXDdt1C46wTBbWShg== X-Received: by 2002:a05:6512:1387:: with SMTP id p7mr6708972lfa.50.1621394258543; Tue, 18 May 2021 20:17:38 -0700 (PDT) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com. [209.85.167.43]) by smtp.gmail.com with ESMTPSA id f4sm3541684ljn.38.2021.05.18.20.17.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 May 2021 20:17:38 -0700 (PDT) Received: by mail-lf1-f43.google.com with SMTP id i9so16798388lfe.13 for ; Tue, 18 May 2021 20:17:37 -0700 (PDT) X-Received: by 2002:a05:6512:1047:: with SMTP id c7mr6691613lfb.253.1621394257275; Tue, 18 May 2021 20:17:37 -0700 (PDT) MIME-Version: 1.0 References: <20210519013313.1274454-1-ying.huang@intel.com> In-Reply-To: <20210519013313.1274454-1-ying.huang@intel.com> From: Linus Torvalds Date: Tue, 18 May 2021 17:17:21 -1000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm: move idle swap cache pages to the tail of LRU after COW To: Huang Ying Cc: Andrew Morton , Linux-MM , Linux Kernel Mailing List , Matthew Wilcox , Peter Xu , Hugh Dickins , Johannes Weiner , Mel Gorman , Rik van Riel , Andrea Arcangeli , Michal Hocko , Dave Hansen , Tim Chen Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=efD+mqUp; dmarc=none; spf=pass (imf12.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.167.47 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 90F25798 X-Stat-Signature: f4z8u951hasmggpu19pij84czqqgtshe X-HE-Tag: 1621394259-482483 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, May 18, 2021 at 3:33 PM Huang Ying wrote: > > With commit 09854ba94c6a ("mm: do_wp_page() simplification"), after > COW, the idle swap cache (neither the page nor the corresponding swap > entry is mapped by any process) will be left at the original position > in the LRU list. While it may be in the active list or the head of > the inactive list, so that vmscan may take more overhead or time to > reclaim these actually unused pages. This looks sensible to me (and numbers talk!), but as Rik says, it would probably be a good idea to move the trylock_page()/unlock_page() into try_to_free_idle_swapcache(), and that would make the calling side a whole lot cleaner and easier to read. Linus