From patchwork Fri Jan 26 08:30:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 13532185 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5C28C47422 for ; Fri, 26 Jan 2024 08:32:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 40C9A6B00B0; Fri, 26 Jan 2024 03:32:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3BD656B00B1; Fri, 26 Jan 2024 03:32:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 283CB6B00B2; Fri, 26 Jan 2024 03:32:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 10F9D6B00B0 for ; Fri, 26 Jan 2024 03:32:02 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A2CC240301 for ; Fri, 26 Jan 2024 08:32:01 +0000 (UTC) X-FDA: 81720794442.23.E7880EC Received: from out-185.mta1.migadu.com (out-185.mta1.migadu.com [95.215.58.185]) by imf01.hostedemail.com (Postfix) with ESMTP id D198D40002 for ; Fri, 26 Jan 2024 08:31:58 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=t38FsnZ1; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf01.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.185 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706257919; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=ul4Yj318/IPfN1mLm2oHYHwsIT4SRkZ2huqI5cSMQ1M=; b=O2AonfSq3UGhYNr4NI84VIBZlhgt/NbKrP/hLNeq6w5UD1slY1hS9WZ494Fd3JeZH9NuGi 2osK+CnOKZH5iXU/lIRqL7uR/hC2P+XuJtZJx2/ufaqEB9fa436qeUGbtKCv7OKOU7PixK PzYHThaVGhrQmQp3UzxAdoB2dCUuKYE= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=t38FsnZ1; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf01.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.185 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706257919; a=rsa-sha256; cv=none; b=IOTdoDZRhNh71R9KohPyrt4KFRkas5+NzQ/A63gmwjDgpQy7qicMNX6pr9J5gh6+BFUIiZ YZLfZ/LVJB1xbBt2//C03euZOOui0Nk5rW7J6SnehxM4MFicQryWqTKTsiqM2H5V0qmovX mwxdMl5tYsi2d8JXhWv8uswchSkWSqU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1706257917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ul4Yj318/IPfN1mLm2oHYHwsIT4SRkZ2huqI5cSMQ1M=; b=t38FsnZ1Muc6VXvBr4BPW2hj/FxunpwClITeZKYaX+yMeSCpB5klMmu1qlnZQ4WYYk6bbD 1GiLoLKVo/wWom1Stp4eARMN/cROOzoWLXX5GTzdXy3ExsHOa9BKTaRBTPCWWV6Uvk/adX uepBwPm12pYL45eeBg0ZxwSF2w5x0dg= From: chengming.zhou@linux.dev To: hannes@cmpxchg.org, yosryahmed@google.com, nphamcs@gmail.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, chengming.zhou@linux.dev, Chengming Zhou Subject: [PATCH 1/2] mm/zswap: don't return LRU_SKIP if we have dropped lru lock Date: Fri, 26 Jan 2024 08:30:14 +0000 Message-Id: <20240126083015.3557006-1-chengming.zhou@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: D198D40002 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: e1qfe38tbp933tox5ynxhqboie1idhti X-HE-Tag: 1706257918-697301 X-HE-Meta: U2FsdGVkX18GsqQv9+uUv9U7SI8cxoFwo2F6mT8fKU2hYCnXez7M27DHcWSxUcRGv1C2AI78blIFDdGsaHEBo8zaGreHtczpmGySPUrj+WxouPyPAZCup6C7o3MkWYEQ7p+t+hocfdDpTq3j5C4Rx6Xp+sAWg19E73uSKmF3OENQ513YuxZpfzRAzRjt/YtBcsf2YbuFCeamJPFtNYnu/aiggWzlOVNmX98lXI6PvGKWl5Zz53dcM+ZoqmmLhJKQd3cdMyeS40BqxsJtLl8+M/p+UPiquDwbfbC8ytkMH4IYXRyw6cDdjzk72Y5gIc6LrNG+irSGXWLFsd4TqntlUuN5V7GVonNVsgMoMpljKW7yvfKJXnQxJmBn9IvTlWmCRVQBzJeYbvF95B1PFbyVM+6eJS50m1TwKPSXgpv3PWmJmX76/yi8dpBEjigg+95U0KNDLiDWozlXetgNMrLqfErJ6uTHbd/hlS2lNyyMhkNWy/C5Fvw080IG1dg30F2pxyy4C2Bw8ep5v6vm6O7dr1oqqqT4zsZPdrPIGAZCwpWK2YwGT5S1tkGq4awggNMNA16JTC/7mmiLrX8626Hf3CFkz0mk9QDxIQGn/tRFdYz6h05i5E5KznJzWOW+JUYGYsM/6gdfqZq8Qu7+rA6K8f3r8iVq49z4gM3eytByyGG13B/TjRngSCQm6+e9Za+UjMA+Nd8bAsvJu+PbeaADShw1Espl6ogiNiG7uwUgWPrh2MVC+UNvUssIrtm/Qc77oeS7u1ZXIIdiGctW6YM74Mw9+SlWPUgCjQjyhPk8lYmtB3WnGUpH5kYBN4FmC5qxEdUjrLI4DT9JTzF4cYusp3Ok5TB9uU3n8Dn9BH/BAzlM9lMgqQkslEMDdNiGewQthOBvhxStnmY9o9W0TfTWfXI1xZhWPCPUauafzEhFDXPVVOyCeEziWlwN4McRYZKdm8Z5mB2U/fQ7QSFlDKA tN5NRC3f khsAmrqjw+8Wiya3vTDRgOWkTpMA3rCxmyN41jNd0/MnQpqKm4OQ9BhxKyZAkFQb5qSUmSrPUX3CmCtV3u/kLVr0nXPGRuoSy0gHnpIj/qp8NEpc6rmat9ALPrBBkwFLT6hmWahmDx0xmwauS/PZrwsNUWajoDdxadMWFwFSkRPwYH+r359FWjJ/mjw== 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: List-Subscribe: List-Unsubscribe: From: Chengming Zhou LRU_SKIP can only be returned if we don't ever dropped lru lock, or we need to return LRU_RETRY to restart from the head of lru list. Actually we may need to introduce another LRU_STOP to really terminate the ongoing shrinking scan process, when we encounter a warm page already in the swap cache. The current list_lru implementation doesn't have this function to early break from __list_lru_walk_one. Fixes: b5ba474f3f51 ("zswap: shrink zswap pool based on memory pressure") Signed-off-by: Chengming Zhou Acked-by: Johannes Weiner Reviewed-by: Nhat Pham --- mm/zswap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index 00e90b9b5417..81cb3790e0dd 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -901,10 +901,8 @@ static enum lru_status shrink_memcg_cb(struct list_head *item, struct list_lru_o * into the warmer region. We should terminate shrinking (if we're in the dynamic * shrinker context). */ - if (writeback_result == -EEXIST && encountered_page_in_swapcache) { - ret = LRU_SKIP; + if (writeback_result == -EEXIST && encountered_page_in_swapcache) *encountered_page_in_swapcache = true; - } goto put_unlock; }