Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1117219rdb; Fri, 2 Feb 2024 14:29:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IGIFiHzrYWM+hoMZcZL4g6WR/cX/soFJeNvmeUQ6ufyJQ1/8UqwzWUfKK3Mvhsw/qXIScok X-Received: by 2002:aa7:dd10:0:b0:560:535:864c with SMTP id i16-20020aa7dd10000000b005600535864cmr688167edv.12.1706912973580; Fri, 02 Feb 2024 14:29:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706912973; cv=pass; d=google.com; s=arc-20160816; b=Xjj79GDGOmnWJUTWFGKFBW8kKaWYEMvqHAHcsnTqrovwqf/ir+FIgguaPLV2P3u0Zb r3lWyyNWFUxjd/p/2B8coQveDOTQKpCsKToG7T7JgrzKUhi+gNHOojN2AkHzlebuAJe7 5morewFJVsPurw5E6w2mMC+f8SpizApipPYFIVwwREEK4W1YzrwAjZ9cL73to722nzjy E+WRW/UwGrBby0/1UEx3DwHm53LcBr87CKNpIc/CrnM0XjPRwTJb0SEyPBRtsAAmnTgv j5K3eU9XBKxF9NvCI/Uu+snw6xIX6JoBBM7otUI5ptdeQKHrqgsFPHB2TMhF1nEmFBo0 efng== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=kpWz3y9T5jk0N4AIQW/ncWnKm//RNwFNaUOWg6Hg2gY=; fh=I0F2YodfQiwdvBk2zg4f9lABp7ctZ2xedPxVRcr1GPQ=; b=lCoVytHc8NrK+QHFjfYFpEKMeNtM2KVHdGyfAM2F6kY/Dl+MGcp4FJJXchhBDlfeM5 2Pd3U8q04Sql7lZkM5tSW+Yr3y+j5KAHc88KZU+pF0xs2wHE1xm5fV2NQBPbOJIaPKsu G0v22JrrCx/aH0SSdzXDXqjrnLWgXrhSmtXSbrbG2jUQlbt6vG96UkUVchBD6Td+C2WG KyDP6NJBJs79dmQe6amcJ7M4o/Zn8XFR5n8xKmr/DmYT33c3J87DiCNwlThBZpVzMCC9 EH4wCxBXYwXTOb9k41YUx8BDaQTdNdN3DokwlEXx+Cut87/I9ccS/kmC5nKahgGDgC/y HtiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gsUjw0ku; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-50667-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50667-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=1; AJvYcCURErP7JWotvNiVo19c0oxQQMxD5ACeIZVfv7hUhvZikgXRXZdJwr/lp3pHJO/8zYlTzBIsJ01KZZ4prAR6hWOMtRshaEi1RJVb4lFQgg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d11-20020a056402400b00b0055ffe188f9bsi741083eda.26.2024.02.02.14.29.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 14:29:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50667-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gsUjw0ku; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-50667-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50667-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2A1341F22718 for ; Fri, 2 Feb 2024 22:29:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E09F126F15; Fri, 2 Feb 2024 22:29:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gsUjw0ku" Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9D50126F0B for ; Fri, 2 Feb 2024 22:29:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706912948; cv=none; b=ml7TfH0xE1iw9IpC9SZFkAZSrySyJMMkbfc7SbNzbgAc07TkEr5xK4Pe5+RdODeV4dEVyJv9CbkiBqGAQ3OVKMhaJ1qI2XlanLVWuR+qz2VZ2oJmygdbGadZ1KPRmu5lY9wyaiAXXemr0DbWHdfM/bTnm5REU1PD5iuripdB1UE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706912948; c=relaxed/simple; bh=QQmJYxnUlUSvt1/zDq1r4NkiHQ/BRoPpeizKUvdTjDI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=X8lsql0PXcVMJ4+gyqwcaOc5tOaLr+upbXF4qDSaVJ7ON+m0OD4jCcKVlsufomt/pz6pGUCT6YiwMpeZb8zqjHDTn+GKGkJb7R1lyiI/QR1ct5yvCjYKWiiiX8ugpVFb1rNJNxYxe4F0SqBFMRkimlX0YE8qd9XLZE0fGvzNWpc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gsUjw0ku; arc=none smtp.client-ip=209.85.166.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-7c064c20ad4so18788839f.0 for ; Fri, 02 Feb 2024 14:29:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706912946; x=1707517746; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=kpWz3y9T5jk0N4AIQW/ncWnKm//RNwFNaUOWg6Hg2gY=; b=gsUjw0ku77tD/ANNEO9LvfH3VhISxPHcMBL04DT9CAxN2egW4iYAY8PiGjDRZyfMl+ Zvyv6TYyFMwMt+fFVzc5JajZCN1/CAsV8lg0JJa7d2TDoU/z65u5QlASNCxYYKFtOpMp WdQZWDh2LT9jci3PofFwgrPK2t/UWZCDKdR8s9BGD8oHeMgpduhG3Inhgd+pAmtGO6KQ mcT38qdRZ5uMyWpjmESWsTQsQZj0ANSDde3EKpLwiFvNSi9Hujcnj+P1fQnwlJPdt5MA +edmPtFrLzmVUGz3gdNgi/UGiBc2lyZpVy/ufyLd1uOC8ESkFg28FBtTcnNMmmAp+VSD sO7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706912946; x=1707517746; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kpWz3y9T5jk0N4AIQW/ncWnKm//RNwFNaUOWg6Hg2gY=; b=Vs3h3LB+7/dqBKMh1CE2PUkj9g9DfPljmPWN289jU+ebmggRq5WhwBbqtHyS5GD38i SbxE4kDfjkYsArxTXdwlGBTe/oeF/+lIElhy5qPr5UojlsjQgNs+OXT05HNmGSyXc1HE N4TPM7030thZcPvhQSr765FyHOKZiXUp4hainfQB5R7C68vxaiRmCl4r+b6LyzQuK0Nx 1cAW2MlnRR/oE6YHzoV+SMARTzDi388Ezqjx3PZeBu4v+UiQghydf9mTX1FRu65mCZR+ r6WpPV79V4UzqFNwZ7B5uF2r0IOXw1Hh7TTlB1eRKYcDQJ7Rp4Lom1R2cXeN5HDqgS1F B0kw== X-Gm-Message-State: AOJu0Yz6rYap8G+7ZXBSN2Ro58Qp6O2xeEHR1mx0X/cJa7c8atNfsDV0 et3Qnt+dvwaHphOwKOYNb58g1ZB/+NZCmw4A9caBOfRVRq7UTrx8vyJEZWFDUSOQFwWF03fbvud IN2XesZenB2kWsSNY4ovKnhVixih/w19Xj7g= X-Received: by 2002:a05:6e02:1a43:b0:363:8d25:a0a4 with SMTP id u3-20020a056e021a4300b003638d25a0a4mr380931ilv.12.1706912945776; Fri, 02 Feb 2024 14:29:05 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240201-b4-zswap-invalidate-entry-v1-0-56ed496b6e55@bytedance.com> <20240201-b4-zswap-invalidate-entry-v1-4-56ed496b6e55@bytedance.com> In-Reply-To: <20240201-b4-zswap-invalidate-entry-v1-4-56ed496b6e55@bytedance.com> From: Nhat Pham Date: Fri, 2 Feb 2024 14:28:54 -0800 Message-ID: Subject: Re: [PATCH 4/6] mm/zswap: remove duplicate_entry debug value To: Chengming Zhou Cc: Johannes Weiner , Andrew Morton , Yosry Ahmed , linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Feb 1, 2024 at 7:50=E2=80=AFAM Chengming Zhou wrote: > > cat /sys/kernel/debug/zswap/duplicate_entry > 2086447 > > When testing, the duplicate_entry value is very high, but no warning > message in the kernel log. From the comment of duplicate_entry > "Duplicate store was encountered (rare)", it seems something goes wrong. > > Actually it's incremented in the beginning of zswap_store(), which found > its zswap entry has already on the tree. And this is a normal case, > since the folio could leave zswap entry on the tree after swapin, > later it's dirtied and swapout/zswap_store again, found its original > zswap entry. (Maybe we can reuse it instead of invalidating it?) Interesting. So if we make invalidate load the only mode, this oddity is gone as well? > > So duplicate_entry should be only incremented in the real bug case, > which already have "WARN_ON(1)", it looks redundant to count bug case, > so this patch just remove it. But yeah, I have literally never checked this value (maybe I should ha). I'm fine with removing it, unless someone has a strong case for this counter? For now: Reviewed-by: Nhat Pham > > Signed-off-by: Chengming Zhou > --- > mm/zswap.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/mm/zswap.c b/mm/zswap.c > index 4381b7a2d4d6..3fbb7e2c8b8d 100644 > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -71,8 +71,6 @@ static u64 zswap_reject_compress_poor; > static u64 zswap_reject_alloc_fail; > /* Store failed because the entry metadata could not be allocated (rare)= */ > static u64 zswap_reject_kmemcache_fail; > -/* Duplicate store was encountered (rare) */ > -static u64 zswap_duplicate_entry; > > /* Shrinker work queue */ > static struct workqueue_struct *shrink_wq; > @@ -1571,10 +1569,8 @@ bool zswap_store(struct folio *folio) > */ > spin_lock(&tree->lock); > entry =3D zswap_rb_search(&tree->rbroot, offset); > - if (entry) { > + if (entry) > zswap_invalidate_entry(tree, entry); > - zswap_duplicate_entry++; > - } > spin_unlock(&tree->lock); > objcg =3D get_obj_cgroup_from_folio(folio); > if (objcg && !obj_cgroup_may_zswap(objcg)) { > @@ -1661,7 +1657,6 @@ bool zswap_store(struct folio *folio) > */ > while (zswap_rb_insert(&tree->rbroot, entry, &dupentry) =3D=3D -E= EXIST) { > WARN_ON(1); > - zswap_duplicate_entry++; > zswap_invalidate_entry(tree, dupentry); > } > if (entry->length) { > @@ -1822,8 +1817,6 @@ static int zswap_debugfs_init(void) > zswap_debugfs_root, &zswap_reject_compress_poo= r); > debugfs_create_u64("written_back_pages", 0444, > zswap_debugfs_root, &zswap_written_back_pages)= ; > - debugfs_create_u64("duplicate_entry", 0444, > - zswap_debugfs_root, &zswap_duplicate_entry); > debugfs_create_u64("pool_total_size", 0444, > zswap_debugfs_root, &zswap_pool_total_size); > debugfs_create_atomic_t("stored_pages", 0444, > > -- > b4 0.10.1