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 D2643D339A8 for ; Mon, 28 Oct 2024 17:20:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C8576B009B; Mon, 28 Oct 2024 13:20:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 678526B009C; Mon, 28 Oct 2024 13:20:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 540786B009D; Mon, 28 Oct 2024 13:20:05 -0400 (EDT) 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 37D616B009B for ; Mon, 28 Oct 2024 13:20:05 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B9F3A140C55 for ; Mon, 28 Oct 2024 17:20:04 +0000 (UTC) X-FDA: 82723673382.05.A63EF4D Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by imf27.hostedemail.com (Postfix) with ESMTP id C04CA40009 for ; Mon, 28 Oct 2024 17:19:38 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=QUZWASmP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.208.54 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=1730135828; 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=/eVHk3AW7gexiX7PCuaMlSsl6eHUqJBpZrMSinpxlxM=; b=obO7WbMouM/PLr6qTtvPyoK2QmMw7pbNvyZSPdbDg/gq+S30p67sltb3O5X7QjfHk+Lkao 4/NrzrClwo128Xy1M7hLpq7Sx3qBGOe+ocJCr8mJM4ZRaYcKM34CxC6NpDCofkeOMqGKNp IsZIa1BgCympNY/xdvb0r/95Qy9S2RM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730135828; a=rsa-sha256; cv=none; b=RRHm+IuMdQlRwZ3ulJnXhFm4ONUgQY4RMdLvl492e5KDdHsKe1egPg9fKyOt7x0A/Jd/tS bvw7UNLmXMb9sKvUqXNsbsU+EeGWvMHN9+C1BK9cpdaAaMIh6aDHo/VXcZkiqApaVGqk74 Mb+euGLXBfqgJw/IhAJS5TmehOa6Kg0= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=QUZWASmP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.208.54 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-5c9362c26d8so9922783a12.1 for ; Mon, 28 Oct 2024 10:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730136001; x=1730740801; 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=/eVHk3AW7gexiX7PCuaMlSsl6eHUqJBpZrMSinpxlxM=; b=QUZWASmPVcIF7kovDT6pxKFMXB52gNYlCp+YzoQF3PlTF17gHuOtsSmCTDxWQHK2xu 8pvJGYGkKaWj5mk2D7mJ2J+dohqTN5SSVUn/OdDhaUFbvnErUUDMWoaBEQXSXm6JJcmK QIzBCB9l40yzzksBMaxEuG3iYHalA0MKn8oLniv2EV+ZadcGKWAcM9K8brPYljORGxQp 5j5sYCdQacrxsxMVpiDTvwKt/h4B9Jkw7iUIsFGlk4fU/1vsx8Qj/Ct0P8n6bAtce1RI j6gBiEQ1NOkeG/OeaRnyZUZ5c5dA5Xi8z8XnM9fo0jNSJN8+ym9e/VNxiOEB6X24EtUg z/Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730136001; x=1730740801; 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=/eVHk3AW7gexiX7PCuaMlSsl6eHUqJBpZrMSinpxlxM=; b=WkMkSAgEbprkXxF7QtPKw9F5iKKZPMfo348iv9o1KxIwKYNTsfnZXZGfUFtGQZO6RL sVBYvcYq+MT1ndEDidyrKdDi3gly6+ns+ls0si9ydSDkgykXasRY9b/RtQhXqdyHr9FR qlhn3Q4H7pHqn7pEbT6j4/wnSxODj8bncMIcKqkIVbQkyWNmao6mH+gpuMxlHUa0IKlY KjXMSCPokPCPwp5bOIwKrYyr3dEaTpjiAzyqGWcnbxAgnj1C4ypCa1j7ZeyJJL7U6TIc DJwxSoWBrUKVYMgTRQgw517zJO9kVFqSRTFu6GVL96pqEyccn7e3W8GVTTjO5UajMPgO Gszg== X-Forwarded-Encrypted: i=1; AJvYcCVjuFMDxnjM9obPkI2Cx+vc95/Zv67yO40F1D9TEa+Tr7EJR1mG51nsb8fxGKkyPn9yG+iCrCHOdA==@kvack.org X-Gm-Message-State: AOJu0YxLqy+tdgxwmRAkJy/rfwObaPEz9IlUpg1nWsEspxkj4yKCN2I0 +2921TvsSl7dNwmGJ5QR02O5QABaN4F3KGKXss4ozG/9jeMNExMP X-Google-Smtp-Source: AGHT+IEscDPCM9cn12k4IcZouQpiYm6zyHeuc25wHiqlz9PCBSKJZWHRvo5xoi99boMMwTEwSJedOg== X-Received: by 2002:a17:907:9808:b0:a9a:ca:4436 with SMTP id a640c23a62f3a-a9e2274cc43mr25156366b.13.1730136000899; Mon, 28 Oct 2024 10:20:00 -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-a9b23027154sm396403866b.146.2024.10.28.10.20.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Oct 2024 10:20:00 -0700 (PDT) Message-ID: <64f12abd-dde3-41a4-b694-cc42784217fb@gmail.com> Date: Mon, 28 Oct 2024 17:19:59 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC] mm: count zeromap read and set for swapout and swapin To: Yosry Ahmed Cc: Nhat Pham , Barry Song <21cnbao@gmail.com>, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Barry Song , Chengming Zhou , 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> <6303e3c9-85d5-40f5-b265-70ecdb02d5ba@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: rspam07 X-Rspamd-Queue-Id: C04CA40009 X-Stat-Signature: f91j39jjshwk7p4rxo8aodpsjtowrn1r X-Rspam-User: X-HE-Tag: 1730135978-317003 X-HE-Meta: U2FsdGVkX18Ggtz/ta7TBgBVqQQFs3QfQG/bl5ROFrLyFC4shGw2aCxSF5K/O1jbpnwSHcTMnikEM4/1kxWIqCQaxTbfu8iTab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iZ330ij2APPQ1g6IuRFGZvWnKnixMWbGGV6RvfyYNGtyYJB/X1+L7ODvdQcZA0otWnyRD6JZn4Z/jR9NTZEX/r5ptQyxcaUbjy8cRn0lUesp6BL7MRlvM6fXuicGRTHtqlWtCJFIiWYEyVvx4GEx2mCngFQHhxw0uZUhkA20tpkrDL4IBRnZ+y56I6PBksynfo6CBz/4ESjqWU10OHw7fhE1WcYQmX5DEjU/37Li0sRUEoARBl5kjOW4Ljrka2QhEop/Zb9O6QQNA4tz5vwFEeGpg7uC1fb1weHnCFjR9AgDpILINN4aL1hJkjGIqxD8Dq5HS8cysLv6AoPP7aXTSnoIi5Uuz5J/xiB+IbWwI/aU6BtDkDQNzt1A/20XvQ== 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: On 28/10/2024 17:08, Yosry Ahmed wrote: > On Mon, Oct 28, 2024 at 10:00 AM Usama Arif wrote: >> >> >> >> 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.. > > Not for or against here, but I would say that statement is debatable > at best for memcg stats :) > > Each new counter consumes 2 longs per-memcg per-CPU (see > memcg_vmstats_percpu), about 16 bytes, which is not a lot but it can > quickly add up with a large number of CPUs/memcgs/stats. > > Also, when flushing the stats we iterate all of them to propagate > updates from per-CPU counters. This is already a slowpath so adding > one stat is not a big deal, but again because we iterate all stats on > multiple CPUs (and sometimes on each node as well), the overall flush > latency becomes a concern sometimes. > > All of that is not to say we shouldn't add more memcg stats, but we > have to be mindful of the resources. Yes agreed! Plus the cost of incrementing similar counters (which ofcourse is also not much). Not trying to block this patch in anyway. Just think its a good point to discuss here if we are ok with both types of counters. If its too wasteful then which one we should have.