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 4AD2CD1267E for ; Tue, 5 Nov 2024 10:45:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C62786B0085; Tue, 5 Nov 2024 05:45:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BEAC76B0088; Tue, 5 Nov 2024 05:45:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8AC26B008A; Tue, 5 Nov 2024 05:45:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8B5D16B0085 for ; Tue, 5 Nov 2024 05:45:00 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 075FA12106A for ; Tue, 5 Nov 2024 10:45:00 +0000 (UTC) X-FDA: 82751707710.26.E988849 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) by imf26.hostedemail.com (Postfix) with ESMTP id 08448140018 for ; Tue, 5 Nov 2024 10:44:32 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hMscoXTT; spf=pass (imf26.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.208.47 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730803449; 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=a4rdU83y0/hJku5ReZd9jrrZkW+8qfyuFGOI6c1YskI=; b=jiuB3PQjQwKss7E7YcZtpM/7XQQhdNyi5ju9CTds+9dTbfqnOvkBJcKr/4x69dbGS+Ooxj EpRXEKiHwlfVEmeXz8izSYhhGmxZcksdjO9wf9glWq83jGq6Jxp7ZnE++w04LjBevF6E0b v/su2ubysN4TfMkqV2K+SyC3+WphK8s= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730803449; a=rsa-sha256; cv=none; b=vMa0VM3PZMliKdP1NKCPpI609Ca74lrC/UoS/OK2rnDq2r/pvyccTW7BAuRs58I01cVeqB vsTItub/K70/6QpwaP1Z7mgsIwrCWHPUDP5f7Ei3nLlg3DOvt4H6c3LVZZqP8MOpiz5jgL 64If9Zmu0ByKaL08KMf8Kr3m2eCXm3Q= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hMscoXTT; spf=pass (imf26.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.208.47 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-5ceca0ec4e7so3553545a12.0 for ; Tue, 05 Nov 2024 02:44:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730803496; x=1731408296; 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=a4rdU83y0/hJku5ReZd9jrrZkW+8qfyuFGOI6c1YskI=; b=hMscoXTTtD58SGAvTRCGScxDJxyw4ubEiL7JX1Cy4Kol2Xe9A5UzE7bIxJMrwLDPll vkMV4vbQiXsk8jOH+YZHBxX18ErKoGs+hJw13ucjzO4OuksTNWjXJdNs1k2d8Unqlirp BX00rBLw38/j2KjkLFCRwN6rQFYPDKrBRNIK3lvAN+4FdqfaCErSh60PjIiKcU3Su25N 96M//kcwhLzr9zr2bn8BcB2LUs3K2O4l1fuYoyc0yaNsQbFTI7SrnseNNT3VtxcTR/6m X0sZRSn7nw/QL6c7O90zmVu4RjG4wDud/t9zRqRXou+PM5kyg/WMm17eSxGMMlubABEt SLTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730803496; x=1731408296; 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=a4rdU83y0/hJku5ReZd9jrrZkW+8qfyuFGOI6c1YskI=; b=MxB/iqrXc6BRMPxzOGIcJSqGRjjJ3eP8SEy2HNe8QXKdMdODivJtf2QD0T5hX6Y24P PrgF0z0YxqFzI2Q4gvtYTw9Y7fkyIqc8QPXfHpz7cYWK2ID3CRmoKHvnmHWKbamyAyg1 f5OupJXdCBPnDnXwadk1qs0Ec1MqwQvqxNG5sXzjPoca09nNhXILe6+K03OuqJE1MPjl NiEnwrOh2HgD0zXAoD2YOL8pqS8VOxeorxeW4bYRxwaylXfaC6Kzwc2G49hMposUNEnt L60CbNUWzdzUj4saCtfjXbFWRUywja/9NSeoly06ifsqNEfDuTCoES9ctTIZ+GfHyWK6 OTUA== X-Forwarded-Encrypted: i=1; AJvYcCWDQBW2KU99AAfu2qIKvYxKECjchKESgYj9ZWoeh6C/vntOnOxulskM84mmgEfiFl6pmL9Z7nTdjA==@kvack.org X-Gm-Message-State: AOJu0YwNeGZcgwg+bPXzhKc8r3Lu2bTIKxNwH0qGx/mxmWHt0XLKLqPs z8PwSVKcUL5FcKsARzKc+DokGvTidwAyC9poPaJVcsTvPafDp0Vi X-Google-Smtp-Source: AGHT+IH7z8nVS3sO8gLWCgeiw+5r/u6WLQWs5v4XPjqhjv6BoX0tHqPso7RViFH9EBKKCBbHs3OBQg== X-Received: by 2002:a17:906:da8b:b0:a9d:e01c:470c with SMTP id a640c23a62f3a-a9de5f36832mr3913434066b.39.1730803495969; Tue, 05 Nov 2024 02:44:55 -0800 (PST) Received: from ?IPV6:2a03:83e0:1126:4:eb:d0d0:c7fd:c82c? ([2620:10d:c092:500::4:efee]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9eb18140a6sm115057366b.195.2024.11.05.02.44.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Nov 2024 02:44:55 -0800 (PST) Message-ID: <11bd51b2-fa2d-4d99-912a-563521aaa6da@gmail.com> Date: Tue, 5 Nov 2024 10:44:54 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] mm: count zeromap read and set for swapout and swapin To: Barry Song <21cnbao@gmail.com>, David Hildenbrand Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Barry Song , Chengming Zhou , Yosry Ahmed , Nhat Pham , Johannes Weiner , Hugh Dickins , Matthew Wilcox , Shakeel Butt , Andi Kleen , Baolin Wang , Chris Li , "Huang, Ying" , Kairui Song , Ryan Roberts References: <20241102101240.35072-1-21cnbao@gmail.com> <6c14ab2c-7917-489b-b51e-401d208067f3@gmail.com> <3f943f72-59d6-4124-96b2-e0bb8d7a5ebd@redhat.com> <20241104194024.0284288a28a71a70a3eab9b0@linux-foundation.org> <942f8355-4b23-4fd9-b00e-1121552d89ee@redhat.com> Content-Language: en-US From: Usama Arif In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Stat-Signature: 7buszkqbbfm1ckofh4uo4sfyt31keoj1 X-Rspam-User: X-Rspamd-Queue-Id: 08448140018 X-Rspamd-Server: rspam02 X-HE-Tag: 1730803472-787740 X-HE-Meta: U2FsdGVkX19x/zOZFJg0L3+aHCFNvLaYa5lZwFX/JuBPSmQcSZO0WE/XxzQ2DTFlV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MboEK3VgdtDEW3bj89MCDK+wJXYXtFuiq5Cc5xXTqVPqYvZcqVgtMdWaJ+12XvF81lqddAcpN+SG+UkFOjUNQ9j9tcfG9nMQWdaPsQor4RHOaj42oWHM+E6J2tsK0NgZZPQTUOJNl4NIj3VHaSPy3r9A7HEE0Z9IrUrV9dm4y4wBSXeUerly8YUqbs/9vL0gJfKiKd1yj92VJjbg7PMIbBFLq+PzzL2CDhgeEhPdqz42VH4YNI01hwlQHJrKpEpHwoF8TkKXOfrg55kuvvMnIH1IJ1HTBOJdJ/0cipIdc9YDS3tMt7LnJfa8Va6a2sHrjq5dWWLTBNyTtBmdQYcz613KaeICOZ9MbDYnS98g== 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 05/11/2024 09:15, Barry Song wrote: > On Tue, Nov 5, 2024 at 9:23 PM David Hildenbrand wrote: >> >> On 05.11.24 04:40, Andrew Morton wrote: >>> On Mon, 4 Nov 2024 13:32:55 +0100 David Hildenbrand wrote: >>> >>>>> As mentioned above, this isn't about fixing a bug; it's simply to ensure >>>>> that swap-related metrics don't disappear. >>>> >>>> Documentation/process/submitting-patches.rst: >>>> >>>> "A Fixes: tag indicates that the patch fixes an issue in a previous >>>> commit. It is used to make it easy to determine where a bug originated, >>>> which can help review a bug fix." >>>> >>>> If there is no BUG, I'm afraid you are abusing that tag. >>> >>> I think the abuse is reasonable. We have no Should-be-included-with:. >> >> A "Belongs-to:" might make sense, for this kind of stuff that is still >> only in an RFC. Or we update the doc to explicitly spell out this >> special case of using "Fixes" to sort out something into the RC. >> >> Because if this would be already in a released kernel, it would get a >> bit trickier: stable rules explicitly spell out "fix a real bug". >> >>> >>> 0ca0c24e3211 is only in 6.12-rcX so this is the time to make >>> userspace-visible tweaks, so the 6.12 interfaces are the same as the >>> 6.13+ interfaces (which is what I think is happening here?) >> > > And including the Fixes in this patch might be useful to someone who is >>> backporting 0ca0c24e3211 into some earlier kernel for their own >>> purposes. >> >> Just to be clear: adding new counters would hardly be fixing existing >> tools that perform calculations based on existing counters. So we are >> already changing the "userspace-visible" portion in some way, and I have >> no idea what in vmstat we consider "stable". >> >> But I still don't think it's all that big of a deal except in some >> handcrafted scenarios hardly anybody cares about; the cover letter is >> also pretty clear on that. > > I may have been mistaken in the cover letter. According to the zswap data Usama > provided for servers, zero-filled pages accounted for about 1%. 10% not 1% (https://lore.kernel.org/all/20240612124750.2220726-1-usamaarif642@gmail.com/). > So > really doesn't > matter too much, but I just checked with Hailong from our team—he has data > on same-page-filled usage in Android apps, which on average show 3-4% > same-page-filled, with over 85% being zero-filled. Some apps even reach > 6-7% zero-filled pages. We previously used these counters to profile > optimizations, but with zeromap now serving as the frontend for swap files, > those counters will disappear entirely from both zRAM and pswpin/pswpout > metrics, as folios are filtered earlier. > This is what I meant in https://lore.kernel.org/all/79deed1a-9b0e-42e0-be2f-f0c3ef5fee11@gmail.com/ when I said it affects zram as well! I am happy with the current version of the patch, just need the change in Documentation/admin-guide/cgroup-v2.rst. Thanks, Usama > Hailong essentially has a table that looks like the below which could be > collected from the existing counters: > > com.xxx.app 5% same-page-filled. 88% zero > com.yyy.app 6% same-page-filled. 85% zero > com.zzz.map 6.7 same-page-filled. 88% zero > .... > > Anyone on 6.12 will be unable to track zero-filled pages unless they > backport this patch from a newer kernel version if it doesn’t make it > into 6.12. > > Whether it's marked as 'Belongs-to:' or 'Fixes:', I'd prefer we aim to > land it in > 6.12 :-) > >> >> So I'll shut up now and let people figure out the naming first, and if a >> new counter is required at all :) >> >> -- >> Cheers, >> >> David / dhildenb >> > > Thanks > Barry