Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1926501rda; Tue, 24 Oct 2023 07:27:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHNe8HFeRI6yqpBkc0g5BkMVCRC06yU3b7mWHok+iiwLKxh54m/azmMcQ37H8znG+TYGA5V X-Received: by 2002:a17:902:c1c5:b0:1c9:bfdb:aad5 with SMTP id c5-20020a170902c1c500b001c9bfdbaad5mr12060984plc.24.1698157661301; Tue, 24 Oct 2023 07:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698157661; cv=none; d=google.com; s=arc-20160816; b=GiHSPKF34Q/3vMRsqq8iQsm8j6wo8uic8RgKGIaNBn9P9WXk/XbOwnGubsCpbXAhrE iHOyj6tzviKLd034NZYfNO5QXKfykQpMwvNOcadmGOn7sSQCvNC6+wFGPkK0liPXDNBn /YoN27qvbW/T5r3Tl6SKo3LmFZWVSuP3hUZ2TIS+Xj4GVABHCW56SoPNzso+XhsFHN7p QcE3QBHiJwxAX8Xe2GcGvz2tWBZz0DGiKe+wK27K9gEOLW4zvNY/XYUz7QBBe066yLtb Ul6KdNp2Ss7aznqDNI8W8tuPgUsCDc278V+Lqu7xuarHzDa8APMLYmJmetSBGzeQocvq 12CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=YcQTC+eJzzLlnaNT0UmsWQUFrQijvQZ05PsjYq0iiBE=; fh=PszaQX4C+JKV5DOkv5b1oVfFmM+viGnqQb7kiYaHXAg=; b=ZLzQaH7P9DdXcWUDNAXjXmxP1C+PU2DBNEc/7nlSGKBWBkDoLsIiyzsoLZNdsiYNyS WpEnrwfhHOUBuP97gke4ZibWEYL4LG0Qi682mvAhWbfWUybyAqXIHRu9Zk928QhUc0ND pMHozXBLRciH3dsKbKSTDx1M8ugPR72AtRoUDkzhqKWT9JExl6p7ej7YAwbE3gTrNyhO pmw9nJ+wg2gNLwKVs7hi8TBs7hbCGBSJt+dEcGiuNDImPVsfsTHgSu9nJ18y5gxmEao4 RmZYNUaZjAbJ+gw4uu7NQ2hW9j0xfGth+zlmxDFlsjVzHjpSQglfqNVnH4QZDs2e1UUs ro5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=ReFm1ccB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id u5-20020a170902e5c500b001c6069b659csi8581872plf.384.2023.10.24.07.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 07:27:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=ReFm1ccB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 937F5803F948; Tue, 24 Oct 2023 07:27:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343601AbjJXO10 (ORCPT + 99 others); Tue, 24 Oct 2023 10:27:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234705AbjJXO1Y (ORCPT ); Tue, 24 Oct 2023 10:27:24 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F2F0118 for ; Tue, 24 Oct 2023 07:27:22 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c9d407bb15so37827635ad.0 for ; Tue, 24 Oct 2023 07:27:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1698157641; x=1698762441; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=YcQTC+eJzzLlnaNT0UmsWQUFrQijvQZ05PsjYq0iiBE=; b=ReFm1ccBKvcROySXJNFfIeYwVkc9xhxTm2kQHo9OOV+VtBCm3lr9tpyEf2D6LnSZt2 IBstcR6Sl3hq9n0kwpNRModkrUAWsJ9zq1mL41xuRjiUSCQpqvbw6BMahbhej5c6wlKW +1XyYhlSrj0sLigAndFTPStHBTrx/SjxzdrBPIeUi8riRYSL/Cf72RsbrKZ7ietDnB1s kQCxJv9YfXvfPTzX3Xtk0QnvmhIh9IGGVf8boUkCBLY7UGQW6JCULLnW7yY8QosekCOy VTrP2pJVFjxpXYMgZom8jfxGxNFlYa4daV9qX03FZYNuHodglKjHDjvi3Ds/qmNlLT/f w3PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698157641; x=1698762441; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YcQTC+eJzzLlnaNT0UmsWQUFrQijvQZ05PsjYq0iiBE=; b=OJENbDSKyLidnFnEm57lm0w6usooQGTuPwS4lk4jhg7upSV18BpMKqnr1TmlxCtW6q rViKDiHZdlvhteT6LleBfRjQp7gcez5GoDyMI57kJPRVIaEBEHS1AsvRkymgNtw53iTf K/QwU+FqffdE7WARu55t4+vK6J1tPiUVIrJrHCmW7t6erVKDrwaokIYDBws0/4qn0XIL T9nmpGl5k9WJTr3l1ekzHhLG7sDtXsUGMwg9r+ukUxPVBvrrceVhYXSA1uRqzLGKt+6A ciAaoWnLknns4k9quGxSNPqvn43XrReix5bRFoCdh4hYFBAh2ncz7A4Q9ANxmCTy9fiK uRpg== X-Gm-Message-State: AOJu0Yws15TzmtqUNYHGtsZN3JdG5RcjYTiBp3I9VDUH+MqbXkAVTMFo g9x1WXYIhJcX+nwHeMI6/mGFPg== X-Received: by 2002:a17:902:c409:b0:1c5:a49e:7aa with SMTP id k9-20020a170902c40900b001c5a49e07aamr14869540plk.27.1698157641443; Tue, 24 Oct 2023 07:27:21 -0700 (PDT) Received: from Tower.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id 1-20020a170902ee4100b001c9db5e2929sm7488397plo.93.2023.10.24.07.27.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 07:27:20 -0700 (PDT) From: Zhongkun He To: akpm@linux-foundation.org Cc: hannes@cmpxchg.org, yosryahmed@google.com, nphamcs@gmail.com, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Zhongkun He Subject: [PATCH] mm: zswap: fix the lack of page lru flag in zswap_writeback_entry Date: Tue, 24 Oct 2023 22:27:06 +0800 Message-Id: <20231024142706.195517-1-hezhongkun.hzk@bytedance.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 24 Oct 2023 07:27:38 -0700 (PDT) The zswap_writeback_entry() will add a page to the swap cache, decompress the entry data into the page, and issue a bio write to write the page back to the swap device. Move the page to the tail of lru list through SetPageReclaim(page) and folio_rotate_reclaimable(). Currently, about half of the pages will fail to move to the tail of lru list because there is no LRU flag in page which is not in the LRU list but the cpu_fbatches. So fix it. Signed-off-by: Zhongkun He --- mm/zswap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/zswap.c b/mm/zswap.c index 083c693602b8..b9b94cbd403c 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1139,6 +1139,11 @@ static int zswap_writeback_entry(struct zswap_entry *entry, /* move it to the tail of the inactive list after end_writeback */ SetPageReclaim(page); + if (!PageLRU(page)) { + /* drain lru cache to help folio_rotate_reclaimable() */ + lru_add_drain(); + } + /* start writeback */ __swap_writepage(page, &wbc); put_page(page); -- 2.25.1