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=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 A262AC433E0 for ; Wed, 13 Jan 2021 03:09:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E2BD923122 for ; Wed, 13 Jan 2021 03:09:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E2BD923122 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0BEB76B013D; Tue, 12 Jan 2021 22:09:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 047C26B013E; Tue, 12 Jan 2021 22:09:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E518A6B013F; Tue, 12 Jan 2021 22:09:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0164.hostedemail.com [216.40.44.164]) by kanga.kvack.org (Postfix) with ESMTP id CCA046B013D for ; Tue, 12 Jan 2021 22:09:08 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 9553D824556B for ; Wed, 13 Jan 2021 03:09:08 +0000 (UTC) X-FDA: 77699270376.29.girls89_330afff2751a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 6A0F7180868EB for ; Wed, 13 Jan 2021 03:09:08 +0000 (UTC) X-HE-Tag: girls89_330afff2751a X-Filterd-Recvd-Size: 3988 Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Wed, 13 Jan 2021 03:09:07 +0000 (UTC) Received: by mail-io1-f48.google.com with SMTP id q137so1251602iod.9 for ; Tue, 12 Jan 2021 19:09:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4XTi7qJz193CCatw1VL2i3e99Yr9iMSuW3P/w0vdhec=; b=PxOgB6nmU8940+rhdi7M4XIClsmAPp7uzUth/w8zjkT8ydmCU8lCAZ4WxaP8adIJu3 aLP39ElSUSKGa2i6fFRmUVodCm9dSFwB7h8L9vXP8X4jnOmxNIxC9i/4kEpcu3x7SRYY MjWHw29oqza5CmwpqY4I4NTEgLnf+JsfWvIx7tWVccTmm3XGzAF5mVR1aUVEfvqd6sOo edEYkE++Za2DhKeAtzOJT6hd4z9VvwdQGsbBFt7iU1NDZ+f6u+M23CKdqHsZrsJiwoaH ZWcbym3YoQu/E2y0pyzFkeR8fa6rdrLdzP9cItsLyM5g78a8Y+lsrxzPwzeLY85giuXA d5cw== 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=4XTi7qJz193CCatw1VL2i3e99Yr9iMSuW3P/w0vdhec=; b=Bpc4hHNQSMZRFWvzmzDbDLGT6iylE0R92fHnZVVYsAoqE3+G4y76KPIz3MQMqflTto 14tsmRP/0q+qnqvdrEc94YgdDLhgHU2KXr2JPLII1/Ye/04fEyhQ1tbhnSBuEiDGWuLZ gL6VOqUXZ3fk4sxTCROqbHLz4LBgV76OvOxOBK/kwN0mtk/MW6rRfDvVkvlEFaGnxrWx gb4Z/mBtdDKTil77nF4qiq7tbHXvBj46NiLNM8ybWj0uz/ZOExzFAUSudeQXLtqTX72h St1wp+vgceyhxWoTVInPyRAHyuxT4hnhK/FinA7f8Zs93GDvt8ao9788mb/rhnSIlXqc YtAA== X-Gm-Message-State: AOAM533baOj4sf/p8gdrYhAKBlxhzkorJN9zhwitObSadajdjb886QBE 1f8auF3ZoTjZ2Im0lru1tdkIlOHu1uvAMgW0ZM8= X-Google-Smtp-Source: ABdhPJzLik9CoIlicN7Wwc7b+qPIIs9aqFWsy1UISq0XsAKz1vRr1M9lw1Dkg2nhP+KAwrEGerQCC7Ajk4EGmQQ/vcA= X-Received: by 2002:a6b:8d91:: with SMTP id p139mr1231iod.96.1610507347561; Tue, 12 Jan 2021 19:09:07 -0800 (PST) MIME-Version: 1.0 References: <20210113024241.179113-1-ying.huang@intel.com> In-Reply-To: From: huang ying Date: Wed, 13 Jan 2021 11:08:56 +0800 Message-ID: Subject: Re: [PATCH] mm: Free unused swap cache page in write protection fault handler To: Linus Torvalds Cc: Huang Ying , Andrew Morton , Linux-MM , Linux Kernel Mailing List , 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" 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 Wed, Jan 13, 2021 at 10:47 AM Linus Torvalds wrote: > > On Tue, Jan 12, 2021 at 6:43 PM Huang Ying wrote: > > > > So in this patch, at the end of wp_page_copy(), the old unused swap > > cache page will be tried to be freed. > > I'd much rather free it later when needed, rather than when you're in > a COW section. Unused swap cache isn't unused file cache. Nobody can reuse them directly before freeing them firstly. It will make COW a little faster via keeping them. But I think the overhead to free them isn't high. While keeping them in system will confuse users (users will expect file cache to use free memory, but not expect unused swap cache to use much free memory), make the swap space more fragmented, and add system overall overhead (scanning LRU list, etc.). Best Regards, Huang, Ying