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 40305C7EE21 for ; Fri, 28 Apr 2023 16:37:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE8DC6B0072; Fri, 28 Apr 2023 12:37:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A98DA6B007D; Fri, 28 Apr 2023 12:37:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 961C66B0080; Fri, 28 Apr 2023 12:37:39 -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 8856B6B0072 for ; Fri, 28 Apr 2023 12:37:39 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 46A37140189 for ; Fri, 28 Apr 2023 16:37:39 +0000 (UTC) X-FDA: 80731355838.08.2151E30 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by imf23.hostedemail.com (Postfix) with ESMTP id DB356140026 for ; Fri, 28 Apr 2023 16:37:36 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=devkernel.io header.s=fm1 header.b=Cv33vzwq; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=Ci7+E8b3; spf=pass (imf23.hostedemail.com: domain of shr@devkernel.io designates 64.147.123.25 as permitted sender) smtp.mailfrom=shr@devkernel.io; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682699857; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MK+DVxYVvN3aGFxjAA+kdeuA5RkH2tMSRdWjdfgxhi4=; b=h5C7cF2apLHhtzaySEe1LI0kOmiyl2f3zxvO88nTi6OJxS/5c8cItVT7oLJ+YBWwjFNfUo rjE3fm54CceQ0nBS/InC/6ICZQ7XzHIvOo3x3+xJjN5T7jnF/KYg9kWDWHiL+p7S2ZSqkM 9j350e0rRMiUVl9hzAow23kYe/B/26E= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=devkernel.io header.s=fm1 header.b=Cv33vzwq; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=Ci7+E8b3; spf=pass (imf23.hostedemail.com: domain of shr@devkernel.io designates 64.147.123.25 as permitted sender) smtp.mailfrom=shr@devkernel.io; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682699857; a=rsa-sha256; cv=none; b=zgoDkXcMndlMY1JNCoet9K2ecPNqoDvDGnYKXhdH3Xf9MsIe7f/rEUa9/l7D7nMwi8UwEx QoGlDd5rqFz7DXb6zo4U4HYEjfGfGa6gFSFObF1Tcp04J1X7Ad1Euf+wxrQznlvWZGW2B5 EEjSCZauvsDQ6Tgdw2Grhe8dp1G5I3Q= Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 9E77C32004E7; Fri, 28 Apr 2023 12:37:34 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 28 Apr 2023 12:37:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devkernel.io; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1682699854; x=1682786254; bh=MK +DVxYVvN3aGFxjAA+kdeuA5RkH2tMSRdWjdfgxhi4=; b=Cv33vzwqRcNlMFEPWF PU1UKASrD3g0RRDuEazKxFD+Ss6dbx/MzNxqcxOCNCwEfSAPETaDpP7Z6dYbJU9A TvtqpuZUOOQSUZSmdHwy9niUbTVRoca2ADpXtMXC2Qwkped5gawIrQhsIZ/czmns bZrDK9/41dzRYayBYt1C6f3ZXFq4mRDZiRHEoPoAR079kYZNhwU1b1uo/MvYicbE P1kGKFnDVuB9q7KmtCO7/czCxry7O6fjjTbduAPjQLLwks6vYVg0H06YNLVGcjI3 l1VreTG7tH1GR8/mVUIqzlkH+RhhC4zbY62apxc2YzPuSr5+IrmXw3QP8pcvwLjd bm8A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1682699854; x=1682786254; bh=MK+DVxYVvN3aG FxjAA+kdeuA5RkH2tMSRdWjdfgxhi4=; b=Ci7+E8b3jFFPujr459ftatWO7AoLl NW4aG1wRCxPYfAPFWbMneqt+v2Me0fxZz4vfabRhAssubeQa1+jD7bI279JaO8vd US72syhK0W3PbY0AeWPyKSmKmkwoxN5BgQI+GGB2Mx7HMTDYawfBiPZCQ3ISRVxC XFU/paA0Z5HsAa1UNrpMzsv1Quimy9RQvNhMk2z1V2RW1unSIyPl6Vp+iG4Eqjhi Qk0ZTlp9fSywv42ixfTR01k9SKWMpbpUibp1uu3e5f+eqcuQO+f3cWDSaedgvH0Q LY3B75Uva3RkD/RZXM2rNhwoSPPIf586QYCg84BrxlFHcRrvDx2XTZQRQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfedukedguddtfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfhgfhffvvefuffgjkfggtgesth dtofdttdertdenucfhrhhomhepufhtvghfrghnucftohgvshgthhcuoehshhhrseguvghv khgvrhhnvghlrdhioheqnecuggftrfgrthhtvghrnhepfeeludefhfegvdffieeuhfdvud etvdetfefgieegffduhfegffeuudevkeeiuedunecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomhepshhhrhesuggvvhhkvghrnhgvlhdrihho X-ME-Proxy: Feedback-ID: i84614614:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 28 Apr 2023 12:37:32 -0400 (EDT) References: <20230418051342.1919757-3-shr@devkernel.io> <20230428093659.23962-1-xu.xin16@zte.com.cn> User-agent: mu4e 1.10.1; emacs 28.2.50 From: Stefan Roesch To: xu xin Cc: akpm@linux-foundation.org, bagasdotme@gmail.com, david@redhat.com, hannes@cmpxchg.org, kernel-team@fb.com, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, mhocko@suse.com, riel@surriel.com, willy@infradead.org, yang.yang29@zte.com.cn, xu.xin16@zte.com.cn Subject: Re: [PATCH v9 2/3] mm: add new KSM process and sysfs knobs Date: Fri, 28 Apr 2023 09:27:29 -0700 In-reply-to: <20230428093659.23962-1-xu.xin16@zte.com.cn> Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: ukrizsp5c4wbpe1gxo9exaysqn5551nw X-Rspamd-Queue-Id: DB356140026 X-HE-Tag: 1682699856-711802 X-HE-Meta: U2FsdGVkX1/UfDFYQ6dWVdIV0G+QqoXFyuhpcPVH9S3jLZOvVjEmdkmUuuhaxFEu/sdU19k98Wj8NSkHOatYJ/1UKMsXe2TjOtwfJDIQxUHs3vp8rLXbWiFd8xgBzkY642GZRM4RGWAfJoIdFoy8sc0KGglA+o1riUpJE+EJqzyMCv4RmeqDUcSLLk7MCigh0pGTiEggOMgUDEgY4fccXOnM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QjDVjXgymIJwVnUdZEOiI7/8rSXOuXvAi9gLuh/RjmJxlw7XNV0qIncnNpzGr9PDHZoHyGCOOigMxP4FMw0Uq/kUswHdVFHHJpxAPm4NfgcDr0fS9Id4h+6wq/hCDX9dHRpzUqazkpy/NbGXw6ohCqzmkCo4gVNAz+eeIY6v2iheaPGsfkEg8ywXPtY3tmOHoPWfaJL1CFBJu9gJwhIqrNXtC+h378enoNz+PRokGq/jqXcXueW7SpeLGtGQI3CP1fsMyaUbwNtBMsqrNqbqEKbO0Hvah3EHXb4sfHkF1+NZ/NGetKF0eBj8pYrOzd/TQ0253mySjBUoHmbZgUmxN1hzthJoy/0= 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: xu xin writes: >> This adds the general_profit KSM sysfs knob and the process profit metric >> knobs to ksm_stat. >> >> 1) expose general_profit metric >> >> The documentation mentions a general profit metric, however this >> metric is not calculated. In addition the formula depends on the size >> of internal structures, which makes it more difficult for an >> administrator to make the calculation. Adding the metric for a better >> user experience. >> >> 2) document general_profit sysfs knob >> >> 3) calculate ksm process profit metric >> >> The ksm documentation mentions the process profit metric and how to >> calculate it. This adds the calculation of the metric. >> >> 4) mm: expose ksm process profit metric in ksm_stat >> >> This exposes the ksm process profit metric in /proc//ksm_stat. >> The documentation mentions the formula for the ksm process profit >> metric, however it does not calculate it. In addition the formula >> depends on the size of internal structures. So it makes sense to >> expose it. >> > > Hi, Stefan, I think you should give some credits to me about my contributions on > the concept and formula of ksm profit (process wide and system wide), it's kind > of idea stealing. > > I wasn't aware the formula that is described in the documentation is from you. I simply implemented the documented metrics. If you came up with it, happy to give you credit. > Besides, the idea of Process control KSM was proposed by me last year although you use > prctl instead of /proc fs. you even didn't CC my email. I think you should CC my email > (xu.xin16@zte.com.cn) as least. > >> 5) document new procfs ksm knobs >> >> Signed-off-by: Stefan Roesch >> Reviewed-by: Bagas Sanjaya >> Acked-by: David Hildenbrand >> Cc: David Hildenbrand >> Cc: Johannes Weiner >> Cc: Michal Hocko >> Cc: Rik van Riel >> Signed-off-by: Andrew Morton >> --- >> Documentation/ABI/testing/sysfs-kernel-mm-ksm | 8 +++++++ >> Documentation/admin-guide/mm/ksm.rst | 5 ++++- >> fs/proc/base.c | 3 +++ >> include/linux/ksm.h | 4 ++++ >> mm/ksm.c | 21 +++++++++++++++++++ >> 5 files changed, 40 insertions(+), 1 deletion(-) >> >> diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-ksm b/Documentation/ABI/testing/sysfs-kernel-mm-ksm >> index d244674a9480..6041a025b65a 100644 >> --- a/Documentation/ABI/testing/sysfs-kernel-mm-ksm >> +++ b/Documentation/ABI/testing/sysfs-kernel-mm-ksm >> @@ -51,3 +51,11 @@ Description: Control merging pages across different NUMA nodes. >> >> When it is set to 0 only pages from the same node are merged, >> otherwise pages from all nodes can be merged together (default). >> + >> +What: /sys/kernel/mm/ksm/general_profit >> +Date: April 2023 >> +KernelVersion: 6.4 >> +Contact: Linux memory management mailing list >> +Description: Measure how effective KSM is. >> + general_profit: how effective is KSM. The formula for the >> + calculation is in Documentation/admin-guide/mm/ksm.rst. >> diff --git a/Documentation/admin-guide/mm/ksm.rst b/Documentation/admin-guide/mm/ksm.rst