From patchwork Wed Aug 16 08:34:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13354732 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 098ACC001DF for ; Wed, 16 Aug 2023 08:35:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 86A738D0029; Wed, 16 Aug 2023 04:35:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 81A918D0001; Wed, 16 Aug 2023 04:35:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 695428D0029; Wed, 16 Aug 2023 04:35:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 532B98D0001 for ; Wed, 16 Aug 2023 04:35:48 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2783940E4C for ; Wed, 16 Aug 2023 08:35:48 +0000 (UTC) X-FDA: 81129309576.08.09E2D94 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) by imf09.hostedemail.com (Postfix) with ESMTP id 2F3A014001E for ; Wed, 16 Aug 2023 08:35:45 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=PyfuIsbS; spf=pass (imf09.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.167.179 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692174946; 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=0XOawoAw7JBbYg8TgQbZYqEagcfiYqNfqAyY2NKDB1A=; b=gIKi1h8YqZfP30MkHlZe5K/17y7YZV2LPwB3ydlTRiaY2zCU8GFeUROkwDN7FHVq9nALL3 7ey8utO1I6rBDYhThK0V2scoGuBB5CrdrkAUne448ThAuPJKoEj509YvbD7N1p8NpFS7Mx hJPaTm7G9tMDcopHR3Im5cVdQPaXmsk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692174946; a=rsa-sha256; cv=none; b=Rf6kX4qOSe3jx3k3WAlo9qU9BG2+2u9Y3JT0XTv1LeziH4HrK3a1p6pcv9f9X/b0bhE2Lt f93qoN8HFjuSkdlk6WZQjmr02gI6kZKNTUSuxGaV96WmUyn+EAnmdErrLu1IXCyi1OKpSQ fFchUcA3wDhgS3XSPELeqxC1uG4QWlg= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=PyfuIsbS; spf=pass (imf09.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.167.179 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-3a3ee866e00so1189912b6e.0 for ; Wed, 16 Aug 2023 01:35:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1692174945; x=1692779745; 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=0XOawoAw7JBbYg8TgQbZYqEagcfiYqNfqAyY2NKDB1A=; b=PyfuIsbShqpwpbjl4vofYUk+TfdwWstY542diGxwFJ36y7DMcAR/z7hAGvCREmmlaN vNd/GwqFF0aMnpzZBe8NO2dDgD0aqGC2f32Lg6N7HlIg59atjCIL3TLR01ZUU5oMB70U npk1lFX01zank9iFM2udD48/KeFpXVK8djnz15tDqMHZ4HYfGcA2gjs7RsdlD9F0BcP4 430guculcU9h+D7LkNvnSKTLGUJZ3iPK9Qqr5PwInblId0avPRzq2nxZBd1PCi9k9TEU zBkK2NTo4hdnb5g8bNED4hAfSEL+/FPKfrg1qFRMak7Kh3O1iQw8QnUbQJJNLja/4F+f 8AfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692174945; x=1692779745; 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=0XOawoAw7JBbYg8TgQbZYqEagcfiYqNfqAyY2NKDB1A=; b=PYpNG27QHI2j7YJw1WzlQDEK8a3RE+EA94G8zCGqFW1+j4+8FVlajYB7HjnO2KZWhZ taHbHmVdhephmk6q6HgG79sKh7DKQ9FdUGx3ti2UA/vPwi61FNKoes9VPyf3/+NUPldl T4yiudGUx5By7y3QMIrxjSfduPRwpMeBojPrQYBKeH4oCoV3UiSoTdyyu7oye4MIlSOh iY65CFm3E+qttC+L7kBODeu+Luur1vgMHaWTYSZbK0Sc74td87ZsjyCq42LleSTNtZ2D FfWrJHZrdocxF9FOYvPiNwo9aUSei+34MTigl8glbIdj7Pa0846eJBof+iznf5v9h3ex EGXA== X-Gm-Message-State: AOJu0YxIbj9kqf9p4nAjY8TAeNQhDyfGv2ch+H1nDe6o+RT7rX8KLRqF qyDolfKSL78cretOhKhf4RuEvQ== X-Google-Smtp-Source: AGHT+IGA1qVTmfQFv7cpPNrqVYl64zBDExPD4YUQImIxFOPGaIX4C9laxn2JW3k95O2LVpSAmFJCaQ== X-Received: by 2002:a05:6808:1816:b0:3a7:8e1b:9d4f with SMTP id bh22-20020a056808181600b003a78e1b9d4fmr1282984oib.3.1692174945208; Wed, 16 Aug 2023 01:35:45 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id p16-20020a639510000000b005658d3a46d7sm7506333pgd.84.2023.08.16.01.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Aug 2023 01:35:44 -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 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 1/5] mm: move some shrinker-related function declarations to mm/internal.h Date: Wed, 16 Aug 2023 16:34:15 +0800 Message-Id: <20230816083419.41088-2-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230816083419.41088-1-zhengqi.arch@bytedance.com> References: <20230816083419.41088-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 X-Stat-Signature: 7ngeigfrmk1btxdtx7ehcgsehrahm669 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 2F3A014001E X-Rspam-User: X-HE-Tag: 1692174945-755973 X-HE-Meta: U2FsdGVkX19YrW/CgOpqGTetIac9h/kQ0kp3Jq7oOAJwrIrr59VKhpl5r08okfJ8RchGAl9APPOm+GoVY+dwAcBtTZtTHds7alaA3Q9AxuKa2ltvrJUTVnP5Ko/JemtVharZo0OuccY1ZFedLK2vwhU17CeGasShdKwS25HA7DtNUiMJOvspXNb63gtV7HZjtjblFxQW2GwUK77sxkQ7ebw+p97hxHb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J69ihgHdeSqTAClZpD+bKrm7NcWN9zi3G/b/YoqMIe19+9kugEMYbyoNvxRbODyO29C/8QOnJ/suaavqb+9F5t8MFStfSOapt+ngvGDz++pB60ySgAmSx0B2M 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 ++++++++++++++++++++++++++ 2 files changed, 26 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 0b0029e4db87..dc9c81ff1b27 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1153,4 +1153,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 */