From patchwork Mon Sep 11 09:25:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13379032 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 928DEEEB57E for ; Mon, 11 Sep 2023 09:26:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0EBA36B018C; Mon, 11 Sep 2023 05:26:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09B2F6B018D; Mon, 11 Sep 2023 05:26:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E7CFF6B018E; Mon, 11 Sep 2023 05:26:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D711D6B018C for ; Mon, 11 Sep 2023 05:26:07 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B0335A092A for ; Mon, 11 Sep 2023 09:26:07 +0000 (UTC) X-FDA: 81223785174.09.0CD38AC Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf28.hostedemail.com (Postfix) with ESMTP id E07FAC0019 for ; Mon, 11 Sep 2023 09:26:05 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=ezHkgJYu; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf28.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694424365; a=rsa-sha256; cv=none; b=2VyZtS5Xqv+r4hBJ3Fq3Oq2qgMmPas44yg5ar65tcOOvEn/nf+REC6x6ZTFua/NHeO8LM0 Hp7IaF5S+/PpVxBKs9VSdTT/PBJegg0AH0zEml6R4jyNRdNFVtlAs9j50ShfVhWnuVKeiv sIK+4QuyADQVWuYuTdMIVfVETOdYd/c= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=ezHkgJYu; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf28.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694424365; 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:dkim-signature; bh=qVUG22g942iaUGLhRJT9/n3ewjgJXrVN0CQoxG9CnOE=; b=idSyXOQ2e1RJSc/PlGbRWxKpEw3FKxN9tcWXAn3piCToupjwSEZZLj2QH0h1S/m3iVenmv /tf1ckd67AAF0tgik0GjvoivGYvkFiskIOUSef5LJ5iOKY7x5nup39WOttmuUrYCSCSWZJ 9ZuelqomgDiIP1ggpeq907l4H/iqjy8= Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1c3aa44c0faso1744175ad.1 for ; Mon, 11 Sep 2023 02:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1694424364; x=1695029164; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qVUG22g942iaUGLhRJT9/n3ewjgJXrVN0CQoxG9CnOE=; b=ezHkgJYu7VgX73fibR763aGZyoT4c5Nx5bmfVOtt884iTZfpjG5leTEZ+6unIpCtlb k/nE+6mNR4NVPRjuz3dRUV0eGgMiww5W0u1mLcPYoR0hFxlr8lax3BQxbM9xOAzQZlYZ ebruj6JMGG9nzYkOjTxXWOo8DpmxL4Yz3cIEgEP7ZfaIaarIUfPFcRuniACdsb7oGgTo 0qIH0IqGBG0yblty6G7a0eVc1H0NWYC2g+w9LHJOizvCA3yIcOU53qIfyJ74Di+RXD4p x9zpdS02FuiyhoJQMJdNrhVqupogl8fBNXhkOSGQasDfl9loWOq4tVaFldd2qCJSappN N+LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694424364; x=1695029164; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qVUG22g942iaUGLhRJT9/n3ewjgJXrVN0CQoxG9CnOE=; b=svkGlfFG58LhSsnR1NI7VIuZXmJ4x0yCzZOtZ9a00NuFxpTIynXmmrMQbE8auegnLf 7KBJPF10DZbuEIvhkrNB7gUeODk5CT6cAGwIIaTdlelUzYd1XGTYMcO0QhdRgehLE6GM 0jjZH4Z2htmvZOv2iytq7tZTqpEwqXpSiudtF0Z+rI7mdZsUaWFG7DC/vSbhT/m3ROL4 lvAPaEQPikPEtyg5iN7VaWyFElLfTrNsi4KhKifqH3GiPkoQWlHmsnM6SJaTm/+zJbKG pxYa4CmAIlJcEFsKbrUyOii61YIZ12fwcrqaFthj1Hw4n0q2DdfirR9PMDvt70T+0E+L Vlww== X-Gm-Message-State: AOJu0YxYiQl10X3CBR5KvDAk89D5EzRDxVooDdnZS92KK41ARMdEgv7C 4ug2ZNW+3tiX09zDzyy0oY659g== X-Google-Smtp-Source: AGHT+IHQSEcQxQoGnVdTYUbsGDGOAGAYnAIRXR25DjqxYRB9VkIgyzJPkhDpA3YnQ1A5pX3r19YoNA== X-Received: by 2002:a17:902:e750:b0:1c1:fbec:bc3f with SMTP id p16-20020a170902e75000b001c1fbecbc3fmr11475221plf.5.1694424364727; Mon, 11 Sep 2023 02:26:04 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id q9-20020a170902788900b001b89466a5f4sm5964623pll.105.2023.09.11.02.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 02:26:04 -0700 (PDT) From: Qi Zheng To: akpm@linux-foundation.org, david@fromorbit.com, tkhai@ya.ru, vbabka@suse.cz, roman.gushchin@linux.dev, djwong@kernel.org, brauner@kernel.org, paulmck@kernel.org, tytso@mit.edu, steven.price@arm.com, cel@kernel.org, senozhatsky@chromium.org, yujie.liu@intel.com, gregkh@linuxfoundation.org, muchun.song@linux.dev, joel@joelfernandes.org, christian.koenig@amd.com, daniel@ffwll.ch Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org, linux-fsdevel@vger.kernel.org, Qi Zheng , Muchun Song Subject: [PATCH v4 1/4] mm: move some shrinker-related function declarations to mm/internal.h Date: Mon, 11 Sep 2023 17:25:14 +0800 Message-Id: <20230911092517.64141-2-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230911092517.64141-1-zhengqi.arch@bytedance.com> References: <20230911092517.64141-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: E07FAC0019 X-Stat-Signature: d495hyw95hcy5ryio3fx4yhs74r95j38 X-HE-Tag: 1694424365-125821 X-HE-Meta: U2FsdGVkX19ZgLJV4erPA4lAfFCHrwiKnCYUjeR/4oZwpHrAJyPBOZ/OBUvis8xs9UIBtMgFPtMNKiOl9l1wdNjqT1uRyIzmFQEf4vEQwc3pzv8HsiwtTC0L0L/uBLV5DOx6TqHOgcYSRrGrKOQzT2sHis8ODoQ+/xqPLmOg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S4bd/AJaOpBjyalB0+xuy87FkXu2AM5tcnA/TRsR8BRIEhFZsGcBv+NEhaxdiS+BXhtPitgsxKfpDwI6TsiV5gNXSDgPTdLa1vc32SQLMPKzIKxLwFuC2mGzYYXUn167Uyj+b2+EZcTJXhu2hObp7rKJY6VVZvU76Rsg+prxDGXIU5nWEMFqhQ7wemrilI+Zm3rKjdr6zWU= 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: The following functions are only used inside the mm subsystem, so it's better to move their declarations to the mm/internal.h file. 1. shrinker_debugfs_add() 2. shrinker_debugfs_detach() 3. shrinker_debugfs_remove() Signed-off-by: Qi Zheng Reviewed-by: Muchun Song --- include/linux/shrinker.h | 19 ------------------- mm/internal.h | 26 ++++++++++++++++++++++++++ mm/shrinker_debug.c | 2 ++ 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h index 224293b2dd06..8dc15aa37410 100644 --- a/include/linux/shrinker.h +++ b/include/linux/shrinker.h @@ -106,28 +106,9 @@ extern void free_prealloced_shrinker(struct shrinker *shrinker); extern void synchronize_shrinkers(void); #ifdef CONFIG_SHRINKER_DEBUG -extern int shrinker_debugfs_add(struct shrinker *shrinker); -extern struct dentry *shrinker_debugfs_detach(struct shrinker *shrinker, - int *debugfs_id); -extern void shrinker_debugfs_remove(struct dentry *debugfs_entry, - int debugfs_id); extern int __printf(2, 3) shrinker_debugfs_rename(struct shrinker *shrinker, const char *fmt, ...); #else /* CONFIG_SHRINKER_DEBUG */ -static inline int shrinker_debugfs_add(struct shrinker *shrinker) -{ - return 0; -} -static inline struct dentry *shrinker_debugfs_detach(struct shrinker *shrinker, - int *debugfs_id) -{ - *debugfs_id = -1; - return NULL; -} -static inline void shrinker_debugfs_remove(struct dentry *debugfs_entry, - int debugfs_id) -{ -} static inline __printf(2, 3) int shrinker_debugfs_rename(struct shrinker *shrinker, const char *fmt, ...) { diff --git a/mm/internal.h b/mm/internal.h index 30cf724ddbce..939d1227a527 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1154,4 +1154,30 @@ struct vma_prepare { struct vm_area_struct *remove; struct vm_area_struct *remove2; }; + +/* shrinker related functions */ + +#ifdef CONFIG_SHRINKER_DEBUG +extern int shrinker_debugfs_add(struct shrinker *shrinker); +extern struct dentry *shrinker_debugfs_detach(struct shrinker *shrinker, + int *debugfs_id); +extern void shrinker_debugfs_remove(struct dentry *debugfs_entry, + int debugfs_id); +#else /* CONFIG_SHRINKER_DEBUG */ +static inline int shrinker_debugfs_add(struct shrinker *shrinker) +{ + return 0; +} +static inline struct dentry *shrinker_debugfs_detach(struct shrinker *shrinker, + int *debugfs_id) +{ + *debugfs_id = -1; + return NULL; +} +static inline void shrinker_debugfs_remove(struct dentry *debugfs_entry, + int debugfs_id) +{ +} +#endif /* CONFIG_SHRINKER_DEBUG */ + #endif /* __MM_INTERNAL_H */ diff --git a/mm/shrinker_debug.c b/mm/shrinker_debug.c index 3ab53fad8876..ee0cddb4530f 100644 --- a/mm/shrinker_debug.c +++ b/mm/shrinker_debug.c @@ -6,6 +6,8 @@ #include #include +#include "internal.h" + /* defined in vmscan.c */ extern struct rw_semaphore shrinker_rwsem; extern struct list_head shrinker_list;