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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41A78C38142 for ; Mon, 23 Jan 2023 17:57:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232881AbjAWR5d (ORCPT ); Mon, 23 Jan 2023 12:57:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232770AbjAWR5b (ORCPT ); Mon, 23 Jan 2023 12:57:31 -0500 Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A60E32CFC5 for ; Mon, 23 Jan 2023 09:57:28 -0800 (PST) Received: by dev0134.prn3.facebook.com (Postfix, from userid 425415) id 5F7EA5616BE1; Mon, 23 Jan 2023 09:37:56 -0800 (PST) From: Stefan Roesch To: linux-mm@kvack.org Cc: shr@devkernel.io, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [RESEND RFC PATCH v1 08/20] mm: split off pages_volatile function Date: Mon, 23 Jan 2023 09:37:36 -0800 Message-Id: <20230123173748.1734238-9-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230123173748.1734238-1-shr@devkernel.io> References: <20230123173748.1734238-1-shr@devkernel.io> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This splits off the pages_volatile function. The next patch will use this function. Signed-off-by: Stefan Roesch --- mm/ksm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index 88a969849955..19f434f97dc1 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -3182,8 +3182,7 @@ static ssize_t pages_unshared_show(struct kobject *= kobj, } KSM_ATTR_RO(pages_unshared); =20 -static ssize_t pages_volatile_show(struct kobject *kobj, - struct kobj_attribute *attr, char *buf) +static long pages_volatile(void) { long ksm_pages_volatile; =20 @@ -3195,7 +3194,14 @@ static ssize_t pages_volatile_show(struct kobject = *kobj, */ if (ksm_pages_volatile < 0) ksm_pages_volatile =3D 0; - return sysfs_emit(buf, "%ld\n", ksm_pages_volatile); + + return ksm_pages_volatile; +} + +static ssize_t pages_volatile_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sysfs_emit(buf, "%ld\n", pages_volatile()); } KSM_ATTR_RO(pages_volatile); =20 --=20 2.30.2