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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E27DFD3399B for ; Mon, 28 Oct 2024 17:00:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6445B6B0093; Mon, 28 Oct 2024 13:00:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F3EF6B0095; Mon, 28 Oct 2024 13:00:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 494AE6B0096; Mon, 28 Oct 2024 13:00:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 29D406B0093 for ; Mon, 28 Oct 2024 13:00:42 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C45B0A100B for ; Mon, 28 Oct 2024 17:00:41 +0000 (UTC) X-FDA: 82723623528.20.4351C56 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) by imf19.hostedemail.com (Postfix) with ESMTP id 264C41A002A for ; Mon, 28 Oct 2024 17:00:09 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hZEBbqkg; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.218.53 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730134711; a=rsa-sha256; cv=none; b=smkyXGFU4VmPVJ2oMTJScTvMDN09N9u6W2HOvwcwMA6cMs8F7se8ObUjf1KTbk0SwexWZN NHot4l89mN7Oez6DMQqwEEsr2xAvSR3C7uluZ+SmXFZUisF2SRSxEXY/hKVcH72FVe6vSs wmTs4E3rrj+w8KuU8cyjUNnFF0IE0v4= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hZEBbqkg; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.218.53 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730134711; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=lrjMaXXj+jfgf+DVrhrW4u7B5OhsmwVqgofVaVRB/SQ=; b=Sdr74qYVMV071eCScKf4xfqQu9J6S1B/Sdz9h6k8jDYGyimutwUmeIvqBmY2bMR+QmyM7a 2iKadXPORF13phf90ZpFbNJpaqdWZFBhXe3o8fprMvoovt0P1XRIiBGcKgIZj/J7hMGw7J 91BpN6Rp2It6E/FqTofSG+wvJks/p44= Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a9a156513a1so709493866b.0 for ; Mon, 28 Oct 2024 10:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730134838; x=1730739638; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=lrjMaXXj+jfgf+DVrhrW4u7B5OhsmwVqgofVaVRB/SQ=; b=hZEBbqkg3ADbvwSLpJjz6Q1F4/zsBPFHCLwMGEUTfodUYg5YPWJtWCf9z/a8CEJQSh 7IK42h9uah+JysikA0+v2CfYpWDlpw7HBPakvttEvliP8w5SwMbMNO2c6xDhIBVvCXZu lycflUsX392zGjWi8hpw61kkzNduAjah2WYM9FzV3kQN0v3QWEXSwzjKCsRnPL49890z Q6AkYWzHuz7tlA1LrrGl089A7AyFrNkyWEfu8kBC6kM5b4geyzmRhGSHohwl/XZqAFan HUo8IzeiOYnz1WBdYugOstxkvTI39hROrXIqH+468bJrxhWLmJKr38TxTpjAvO1YSHZ2 PXCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730134838; x=1730739638; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lrjMaXXj+jfgf+DVrhrW4u7B5OhsmwVqgofVaVRB/SQ=; b=wa7Jn5Pqpf46qf6ixSJFg0+Gm70YyWb1KcvusaAOcHs0br6qGZPPduvkVOpzt50/m0 0G3wad7nt5BbabcbRj2h5PXEhERNSheScM02iVzFLSNIuZx8hk7petw1qPFbN/he35kW 5AdKA51GL1UJBMucJF4yrdZPg1+0wGRqSOWEhAQ02uEobORcY1P4l1GYx21DAg0g5jkj ziC6INoj1vOzslS6SyXO1dyTwbJy3xB4PtdvTNBcSQkddCp5xQh80ylc2qeXWczrvytL nVBkRh3zwnVATVzOFxd1fI9tfEaVVDTRRBLvuYhmeZ0ZSNnJj351lpMEHoX1SdDIDHpV qf4A== X-Forwarded-Encrypted: i=1; AJvYcCXleIuf8jjMMDPxQBDUOHsXoo2y8g9YppiX+JO/IBLZeebMMSvvi2AZph/eA3FFMEfhjoAz4QeQvQ==@kvack.org X-Gm-Message-State: AOJu0YyKHw4+V0RW4fGytyqkEsCMYqwa7eYVGuFfgWtPHk2DGmZcI01+ yipQ+WDqz8Vu0sWATPyDN7XEzZnLo9DIxHP6hxYBVoxEqT7eRMM8 X-Google-Smtp-Source: AGHT+IEzF2HF0Gq0YJoKVyANSwRvB4fbgapxGgOP0KpiaPUyyvV+ZQPVLjnBVS8Z/Igqo+lFTvOkmg== X-Received: by 2002:a17:907:7d88:b0:a9a:c57f:9634 with SMTP id a640c23a62f3a-a9de61d1a97mr812510366b.42.1730134837616; Mon, 28 Oct 2024 10:00:37 -0700 (PDT) Received: from ?IPV6:2a03:83e0:1126:4:eb:d0d0:c7fd:c82c? ([2620:10d:c092:500::5:1494]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1e0b2400sm392018866b.45.2024.10.28.10.00.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Oct 2024 10:00:37 -0700 (PDT) Message-ID: <6303e3c9-85d5-40f5-b265-70ecdb02d5ba@gmail.com> Date: Mon, 28 Oct 2024 17:00:36 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC] mm: count zeromap read and set for swapout and swapin To: Nhat Pham Cc: Barry Song <21cnbao@gmail.com>, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Barry Song , Chengming Zhou , Yosry Ahmed , Johannes Weiner , David Hildenbrand , Hugh Dickins , Matthew Wilcox , Shakeel Butt , Andi Kleen , Baolin Wang , Chris Li , "Huang, Ying" , Kairui Song , Ryan Roberts , joshua.hahnjy@gmail.com References: <20241027011959.9226-1-21cnbao@gmail.com> <678a1e30-4962-48de-b5cb-03a1b4b9db1b@gmail.com> Content-Language: en-US From: Usama Arif In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 264C41A002A X-Stat-Signature: 43w615ncc6uwaxdxyijipdz6sayfe13f X-Rspam-User: X-HE-Tag: 1730134809-658495 X-HE-Meta: U2FsdGVkX1+f2hNEvmRVYTx2CM6A8yJMszyvhPoKnrhlkBn6kSsvKOCSh4QGMB/SH5NsvzLhF50BqmW+O8lFUF4M9DSr4le/r6B3kYqexaHB/RE6zsmT9p554bwC3If8Z1Kf2HMDlPtDOk3aYc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Ohd7imUil57W8hSQoP4tTE98htsJ+9S6AoHzGzq0TGZG38FStQlRobmmoDkkXJRuhpTKdMhaMK46l0iz8GddNMWrKwVTLkhFHp//dmF5cS8Jgmi9iUKcVoJRp2g3UbKey+4li1R++Lvwqmc8AEqjvOrFGukc+Gj/X5Iy0+aoSEc0SKmAVg0v4DRFWuZQ6rU+uR8iN27SP5ogZ/cuedWhOtwyd2XoFp7OHCFvpCTaF0XNLaC/p4r8YsR4W9X9r1nO9O6uerKKNLge4J1qM1N20/PgdzZkNC+JfDr3ys4AeKYf4iyohTDpZETRIP4+LRZzp12hpJ8cMlPpap/Y5WqFgY/thQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000049, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 28/10/2024 16:33, Nhat Pham wrote: > On Mon, Oct 28, 2024 at 5:23 AM Usama Arif wrote: >> >> I wonder if instead of having counters, it might be better to keep track >> of the number of zeropages currently stored in zeromap, similar to how >> zswap_same_filled_pages did it. It will be more complicated then this >> patch, but would give more insight of the current state of the system. >> >> Joshua (in CC) was going to have a look at that. > > I don't think one can substitute for the other. Yes agreed, they have separate uses and provide different information, but maybe wasteful to have both types of counters? They are counters so maybe dont consume too much resources but I think we should still think about it.. If you think from a production context, I feel like the number of pages currently in zeromap could be more useful than just accumulation of all zeromap loads/stores, which after days is just going to be a very large number. You can compare the accumulations at different points in time, but they dont take into account freeing swap slots and swap_reclaim. If we are open to having both types then its ok. But might be good to have that discussion here. > > The "current zeromapped page" counter gives you a breakdown of where > memory resides, whereas the in/out counters explain past performance > based on events that have happened. That's why you have zswap, > zswapped, zswpout, zswpin.