Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3488019pxj; Tue, 1 Jun 2021 06:31:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziFJDYHD81pP6YK4u/CVOTwqtU7q9/aHbpCRR+UrYb5mKbmkN8kfk+wqhJnnYWtsC4ogrU X-Received: by 2002:a92:3f03:: with SMTP id m3mr20776798ila.34.1622554294797; Tue, 01 Jun 2021 06:31:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622554294; cv=none; d=google.com; s=arc-20160816; b=NIZPoIwi1nRfNEXRh4mZC6ip5J2VgwZV474/4dpAXOyYEVfQSz1u9YL6MmZiBygkuV AQmMnQ7TAXnKEUsMh8aHgbeI8bYJGiUFpOO+Wvjj+DIgBfbAxB5UCQtWofyRSZqTAGvL VQD4F4QK1IVGj+lNVSWkJmQisksNxYB9tLfa3Wnz44L/41Zqu5b+zWZYzvkzzPOejEdf 7wuE4+4Si21f6oWWqofMUH3nMEizjPj+brXF18nWlS2+Pg77PQHtG8qT45c9XS6dyRqb vK9sNbjsZ51uO8rFjz2rZ8XFiWHrcsFJO44Ff0uLxOZ1aDC1I5OA7LwK0A/A1QOVUXzQ H0+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QgAlRC15sowarDmOShJGxWuHEnM/uzw99+W0HvQo4Rg=; b=XH+MCNCq2+Yx5RjRu+gqciZyobhJdQWhBl3rAXtWpmKQLa7xRFuDapQioyODtK2eDn koHrIaJnWG/OYWoSY+KCfYqcZLNNbNatj7u+du6dioVMgC+YtbTEyo4ExIkV23ikpSjn 4WnjZfZgNNgn/eApWvKvFL55BFsMfKyq0bUNc8/Lw3YzuBEEaNqNIioifWLV5zFk0H6X a7o61hYj9p2CgKUO9czOP/pkdMmcwF+24vPoLMkQJPeV5ImlWJZ2MwupD8ofJtgzp9sm 8nHOO8KmGtlirhqvlQised8RCLltvCyLRZWZ3D4AMmh16m+VqEfiIYFjoiX4w1n9ksN3 Erxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=cUUpNv7t; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m20si17943696ioy.69.2021.06.01.06.31.22; Tue, 01 Jun 2021 06:31: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=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=cUUpNv7t; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234021AbhFANcG (ORCPT + 99 others); Tue, 1 Jun 2021 09:32:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234016AbhFANcE (ORCPT ); Tue, 1 Jun 2021 09:32:04 -0400 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E73DCC061574 for ; Tue, 1 Jun 2021 06:30:21 -0700 (PDT) Received: by mail-qk1-x731.google.com with SMTP id v8so14195015qkv.1 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=NNGXCpYNffb1I6aXn2LnTkWi5Rj6Djz9kel3ywHMOg0z8S1WM+o9FmjqMyUJs2IF8+ 7TedKEQoGdaDyM+PU/CjhMSmUWXvvJwPENnK0lR+DxLzSlWOX3tpQg9vUroCQsJ2us/u TEupYEgoz8zIoSYuEh3vjYcAaGbby8rmKbBfYnK3G/f1x7AVrNHdtBMZTjaaTYhM1SP0 1AMiaov3OjK9Taaghiw9O+HYIkHL0p1HfjyxMgIZi+V+q6aW3RqB626RzSoS40UTV/rN XBFFwXz9KVXALxRVmYVFFXbWgF/u+xVXotHqbNOZFKjqlz4MA1Pswrxyn2JOOXYNwOdT Tdhw== X-Gm-Message-State: AOAM532uXBI4uvBB2NHCYIau/DgyLJY7AOFtFedfHaS6/h/oA9posztq thSS9deEXArImrjjQscDo0HFGg== 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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