Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1713629pxj; Wed, 19 May 2021 12:08:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymoGEnRd1qUE99Rp1CfsAqMUU/y+Dv5O6jbrDNwG6RTqK7D2CBkRNkLu0Eb/BXa92p70cN X-Received: by 2002:a05:6402:100c:: with SMTP id c12mr565895edu.165.1621451314072; Wed, 19 May 2021 12:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621451314; cv=none; d=google.com; s=arc-20160816; b=H5RRvLIsAIAcghE/LSfIpCs7R+2RD6aevj5cE23dMFyJIcMZWfrQpdptLinVieDj3v OYPUqWnEFKJWai77Z0VAmeHxW+mZxbdZ5t8qc2+MFZIm/7HM5asJswzkBVbO7C05Uw6P q7HZaqWnYjqfHrqhZLCejDKlIiGIN9r7jTrTJ6i2aYMn8oTL4CxVpsl2hWLxxRHuxWkr hGlHQn5LlR16Sxr8JmMfe3QDF3s71aeacc1oGqRCVx8dLhww0uTCJmK5fhGKkSP2ErQV rcOWt65f6vncDk3mP3i5NODXUGQA+k/5whvCJkhLO7ZuWkzaWWNopM28GR+CyZHm16+5 4cpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=hxNVQPiC8fzbxLiyAUu9bsx0HZLll8xQ7nokNM1IEpE=; b=QeFMdnEwSNSX4RmBc2+1645mV69EhYI6QqVCTEl2zbrpt4a9XU9J3Tfhwbei0Qp+sd UPCmMnI1mVSY5VJj5ey6y9byEQApEyr0EjhFHvP2jkoAoEVQKn+aMiJR2J583BQe53EM hSQUy/5XnPNP0uaB4O1wnJLyvbniU1WOia+eNzipM+a0D+yP9Jqe6cC6IFri2zz6D8xb LzR/J0+/YRKOQsyH0Oq2kbCeXwZrlLdf2zZi6euQiJBDnu06Q4VI+WcpNIr3te0VSl0W BOrFLV1ogAJQiEKriLZI1iszMNodWPXaBvPMIaeAdnWwuJ6lS3KBlXv2/qh+9e4+TRZT yJfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=efD+mqUp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ko1si442451ejc.344.2021.05.19.12.08.07; Wed, 19 May 2021 12:08:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=efD+mqUp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237869AbhESDTA (ORCPT + 99 others); Tue, 18 May 2021 23:19:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237833AbhESDTA (ORCPT ); Tue, 18 May 2021 23:19:00 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06942C06175F for ; Tue, 18 May 2021 20:17:41 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id r5so16819845lfr.5 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=j7Mib+jwBXBe6qpRAzgcyCiVF+g43VMZGdO3YP1OoTdY1Jf0WMS1WbRkbkRWDPikP3 3xd2NypsaLdpfnIcfxTXwbqXZiNmGMlXltV7/5DjoIJUJmi+hvxG8WGrqBEJn+nOAsD2 a3r5enEA0lPjIfenCxYGNx4s5NAf096KdAzVhSL7JZztHaNhbR5y/4I+hZ0mHtkgy2DE bCWsKIO3pyMRNC8Xq+3Jxy+GnJQsUJHaVkZBnR6Vekkd3gA+QY8oYN1YxNM80AilLRLS eQNuuVN6UQas33QyD73sGkITZNQ467hchVvRzkhFndhm3YBKeFCDU5kMuyhVaKzk6fEq yEBQ== X-Gm-Message-State: AOAM530xv54f0q1hZKTo8Fga/UOXYn6Y6mIj5JAqhCM+NL/sfxJqERCM 9DQZnnqR8inLso2CwNajTWMesK6HJNgp5tU/ELI= X-Received: by 2002:ac2:4f92:: with SMTP id z18mr6446690lfs.343.1621394259145; Tue, 18 May 2021 20:17:39 -0700 (PDT) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com. [209.85.167.49]) by smtp.gmail.com with ESMTPSA id j8sm283017lfh.192.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-f49.google.com with SMTP id v8so11843672lft.8 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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