From patchwork Mon Jan 23 17:37:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13112640 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 A3E7CC05027 for ; Mon, 23 Jan 2023 17:38:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F33C16B0081; Mon, 23 Jan 2023 12:38:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE4BB6B0082; Mon, 23 Jan 2023 12:38:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D83BA6B0087; Mon, 23 Jan 2023 12:38:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C6FC26B0081 for ; Mon, 23 Jan 2023 12:38:18 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9F289822BE for ; Mon, 23 Jan 2023 17:38:18 +0000 (UTC) X-FDA: 80386772676.30.E23937E Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf17.hostedemail.com (Postfix) with ESMTP id 01EE84002E for ; Mon, 23 Jan 2023 17:38:16 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf17.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=1674495497; 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=0zP3lOdxr+0UCksWUl3LEQ9z7YRL6nH+bNz8mNUcGwc=; b=uwzYT/dW8ChtNL20sz0CXzhKjSPM9/5jCkt0FjqLLMbnTbgTub5uEOuRVqevjOt0SfdCl2 wUzIU04QjHhuQejKUuelUGjfMUx7a1bTcoHMJfwJPXA4a/adVVfR5B+esSb9bpm2W/NUT8 ihOWx9t63XwV93F3q+T6g+Tx6gO60cY= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf17.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=1674495497; a=rsa-sha256; cv=none; b=RL+bqaVGWZNgxVSKJOOdLwCswmGhtCufothXjZxt6yMQQ9TRN0eO5TxrV6TvJN+LNDBF2X bXzhb+9m+wjXBk7SFJSSeveUa2U7CaYGPOD/iBqRKdVP3h5P5fkj9YB5DKeD41qL9tFeNf SJtRcYHAjs19fIiyIKKld4Nfl2jDz6I= 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 X-Rspam-User: X-Rspamd-Server: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79IQ t402wgvkSe3/g2zOWsU6tYySE6c6i2Vckqz0TOHb16UXpdIKl+SLYza9AWicsNmoxcZvpjE8rdw4S3DfzyJdDcdupAZBbFpthc4to 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 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); -static ssize_t pages_volatile_show(struct kobject *kobj, - struct kobj_attribute *attr, char *buf) +static long pages_volatile(void) { long ksm_pages_volatile; @@ -3195,7 +3194,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);