From patchwork Fri Feb 10 21:50:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13136494 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 BB3BEC6379F for ; Fri, 10 Feb 2023 21:50:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 497A96B01B3; Fri, 10 Feb 2023 16:50:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 44A856B01AE; Fri, 10 Feb 2023 16:50:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2CC0F6B01F1; Fri, 10 Feb 2023 16:50:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1581A6B01AE for ; Fri, 10 Feb 2023 16:50:52 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id DD747AB85A for ; Fri, 10 Feb 2023 21:50:51 +0000 (UTC) X-FDA: 80452727502.23.B97A7EA Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf25.hostedemail.com (Postfix) with ESMTP id 4D3F6A0013 for ; Fri, 10 Feb 2023 21:50:50 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf25.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676065850; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UIkG2ZgW7UEdf64bDBkmG7zVyIev4Y/Do9OCfavY/qY=; b=inwhhVLhhC3LAAufeFxuvTohJzTvxlU3SXpV+K+F4bE5vVoXjdVb8P5J5OHnYf+RnJcsZx yNqNUELWfr/hi1xR4xLLKQ1Lv7aV4BV+oLYF79bc55TJLe5ZPCXurZT5az4/9hRxdDzR80 xfTo0LiWhLpUNSn4+RA9dB77QPGRmsI= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf25.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676065850; a=rsa-sha256; cv=none; b=23PF1P9DYXIA3US3ZIo+B4RREVP74lxfzspCdTeJ5tt3psBPjTpxDeytbxYEa2y8oLb5W9 8Mkp+cMz+csLuO47x78CpIUHn4xbZ0uuytAKR4ljCUeFhUl3rlGDMmpkT95RZ08k9tXBHV PHfMwGXartpgPRWV/PX0KIynreJmsdA= Received: by dev0134.prn3.facebook.com (Postfix, from userid 425415) id 803B06BFC2D3; Fri, 10 Feb 2023 13:50:33 -0800 (PST) From: Stefan Roesch To: kernel-team@fb.com Cc: shr@devkernel.io, linux-mm@kvack.org, riel@surriel.com, mhocko@suse.com, david@redhat.com, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, akpm@linux-foundation.org Subject: [RFC PATCH v2 07/19] mm: split off pages_volatile function Date: Fri, 10 Feb 2023 13:50:11 -0800 Message-Id: <20230210215023.2740545-8-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230210215023.2740545-1-shr@devkernel.io> References: <20230210215023.2740545-1-shr@devkernel.io> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd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J9FOXOl1 4oPUekB1f4AWzklRezPBdB99skqaMxnUxg8PHVwgCQ64HZ61XzF2U4Nrld9RgWfMvm9yoz3GWAB62D2V04sO0MsQqdbF/NPYJDnI9 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: 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 23d6944f78ad..7f3b28b7536e 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -3271,8 +3271,7 @@ static ssize_t pages_unshared_show(struct kobject *kobj, } KSM_ATTR_RO(pages_unshared); -static ssize_t pages_volatile_show(struct kobject *kobj, - struct kobj_attribute *attr, char *buf) +static long pages_volatile(void) { long ksm_pages_volatile; @@ -3284,7 +3283,14 @@ static ssize_t pages_volatile_show(struct kobject *kobj, */ if (ksm_pages_volatile < 0) ksm_pages_volatile = 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);