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=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 D0002C47092 for ; Tue, 1 Jun 2021 13:30:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 37044613B4 for ; Tue, 1 Jun 2021 13:30:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37044613B4 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 B0E3F6B006C; Tue, 1 Jun 2021 09:30:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ABE4C6B0070; Tue, 1 Jun 2021 09:30:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 937EE6B0073; Tue, 1 Jun 2021 09:30:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id 5F45F6B006C for ; Tue, 1 Jun 2021 09:30:23 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id DED643650 for ; Tue, 1 Jun 2021 13:30:22 +0000 (UTC) X-FDA: 78205239084.29.5876107 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by imf27.hostedemail.com (Postfix) with ESMTP id 8CFA48019721 for ; Tue, 1 Jun 2021 13:30:09 +0000 (UTC) Received: by mail-qk1-f179.google.com with SMTP id c124so9429221qkd.8 for ; Tue, 01 Jun 2021 06:30:21 -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=QgAlRC15sowarDmOShJGxWuHEnM/uzw99+W0HvQo4Rg=; b=cUUpNv7ti+RM7h8vQNwO+Z3BWjT9sbNZV3bB/M9kDnNa0tXrvSqWCFblEmZjhRobg/ zDCG8pInQHdVwG8gYjsLO/QJ1C+FV0KFpIRUDeCTVAdW/zoRKPinD9yHTbWioZMcbjvO ZXmwf4/Q0WnftuCPy9vf6zyZ5+FRTcVzC4OH+TXZB9m0ZqM5MIWdB2EZY0AGO/J8OD7a NIOnzAuPJujFBInYuD/Ekg6eLhaUkEdL73WSqTTmdhTJOL714v/Lp6+LTpiy9LHykHA9 mfwVTDm0AFIh79M0ob+0YkzwXYRlyFbaGHXvxGogoZtP94wP/tGbS1v+h46OOuoydXEm jPMQ== 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=QgAlRC15sowarDmOShJGxWuHEnM/uzw99+W0HvQo4Rg=; b=Rst3yorGJiIoFD/6VrWQMKrV24rZjHCAhig4bOjcsKjLAtqg+KYpkVEoxOVohRRUi3 mshnbwVdBK6dgT8Ft1MN2DvGPxf+FbYtUJpOWaURbnR+hucSxAWiKtlsd8tUtle9THJa 18GnW8xxZKOuXmFk0SWXbSat99sjjXtOa4lOu163wHy1/Rhj4DulTSaQ0FLQQZ3urXEZ bhLDCXODFMAln04gWePxmgIZI10b6m4/zbKaEFURzZf0z0PMWx0C7ZbrRd012FQfGzCM tJE1FXm0u76uoiS9B+9pDWYiYbgNRJIeUMFoXzJTi7PHgzSaxfRR7SE5e64+lEWNSyC0 rZ+Q== X-Gm-Message-State: AOAM530oy99q6g2tzDSRrupTdT3Pm0l+Ut8kdL1cqhvMj/8FxFxWBNXc nFMFqoLGoDxBQbpypPrOto0z+Q== X-Google-Smtp-Source: ABdhPJw/BT/krk135SXW8kFdx0bYofrL5Ritm5HfxB3J6reIJGQDviHGncvQp1Vki9UslH5QN8yaCg== X-Received: by 2002:a05:620a:2941:: with SMTP id n1mr21760007qkp.330.1622554221143; Tue, 01 Jun 2021 06:30:21 -0700 (PDT) Received: from localhost (70.44.39.90.res-cmts.bus.ptd.net. [70.44.39.90]) by smtp.gmail.com with ESMTPSA id c6sm4355419qke.83.2021.06.01.06.30.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 06:30:20 -0700 (PDT) Date: Tue, 1 Jun 2021 09:30:19 -0400 From: Johannes Weiner To: Huang Ying Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Matthew Wilcox , Linus Torvalds , Peter Xu , Hugh Dickins , Mel Gorman , Rik van Riel , Andrea Arcangeli , Michal Hocko , Dave Hansen , Tim Chen Subject: Re: [PATCH] mm: free idle swap cache page after COW Message-ID: References: <20210601053143.1380078-1-ying.huang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210601053143.1380078-1-ying.huang@intel.com> Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=cUUpNv7t; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf27.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.179 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org X-Stat-Signature: e15fo7m3aydyh47ify95rtr4q8ezxhyy X-Rspamd-Queue-Id: 8CFA48019721 X-Rspamd-Server: rspam02 X-HE-Tag: 1622554209-292237 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, Jun 01, 2021 at 01:31:43PM +0800, Huang Ying wrote: > With commit 09854ba94c6a ("mm: do_wp_page() simplification"), after > COW, the idle swap cache page (neither the page nor the corresponding > swap entry is mapped by any process) will be left in the LRU list, > even if it's in the active list or the head of the inactive list. So, > the page reclaimer may take quite some overhead to reclaim these > actually unused pages. > > To help the page reclaiming, in this patch, after COW, the idle swap > cache page will be tried to be freed. To avoid to introduce much > overhead to the hot COW code path, > > a) there's almost zero overhead for non-swap case via checking > PageSwapCache() firstly. > > b) the page lock is acquired via trylock only. > > To test the patch, we used pmbench memory accessing benchmark with > working-set larger than available memory on a 2-socket Intel server > with a NVMe SSD as swap device. Test results shows that the pmbench > score increases up to 23.8% with the decreased size of swap cache and > swapin throughput. > > Signed-off-by: "Huang, Ying" > Suggested-by: Johannes Weiner # use free_swap_cache() > Cc: Matthew Wilcox > Cc: Linus Torvalds > Cc: Peter Xu > Cc: Hugh Dickins > Cc: Mel Gorman > Cc: Rik van Riel > Cc: Andrea Arcangeli > Cc: Michal Hocko > Cc: Dave Hansen > Cc: Tim Chen Acked-by: Johannes Weiner