From patchwork Thu Jul 27 08:04: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: 13329144 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 E6C61C00528 for ; Thu, 27 Jul 2023 08:06:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 830376B0081; Thu, 27 Jul 2023 04:06:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E0BC6B0082; Thu, 27 Jul 2023 04:06:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A7CA8D0001; Thu, 27 Jul 2023 04:06:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 5C3196B0081 for ; Thu, 27 Jul 2023 04:06:16 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 33153C109E for ; Thu, 27 Jul 2023 08:06:16 +0000 (UTC) X-FDA: 81056659152.10.68CBB75 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by imf14.hostedemail.com (Postfix) with ESMTP id 4ABE4100009 for ; Thu, 27 Jul 2023 08:06:13 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=AHxGvLfH; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf14.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.169 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=1690445173; 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=hMz0NiXWW4aad/y0uXjwCFa/Ag/H17CXQFU4sIH/+zs=; b=RBmAS2nHrdZvrthg1REhipSj+CIY5KmK6cTYYCOQcN3+HZgQTWJ7FozSB998ixy4xpkJC9 68psOZtEIf0Sz7WOgYJlexh/XH5M5eTtk1N9XG9nyZPItibuhTbAnC+lalhZ8IhC3Z5c7W WsiKeSZJiwrN9Y11a0vt7m6cS9wl65c= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=AHxGvLfH; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf14.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.169 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690445173; a=rsa-sha256; cv=none; b=eujEl7of/NXrL4w1YhRTkc5cjq0OhkaSKt6XujZYy8/8pgoSnITzr6Tucm0kHmGHfu3cVm UaeDppk8esvlqdDJtyzWyhJ/PAI7W6GXRRFOrHVS80TVI0Uw18i22yDuSAU3oMFyfOHQkr B4Zh5VYkloShQ/KO4fRsNbm3oQiPyN4= Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6748a616e17so182231b3a.1 for ; Thu, 27 Jul 2023 01:06:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690445172; x=1691049972; 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=hMz0NiXWW4aad/y0uXjwCFa/Ag/H17CXQFU4sIH/+zs=; b=AHxGvLfHLl40j8B2JJRU5s4VfBVIfkKAsI0cQEyx34RUKm+kvHJrB2iQzGzRnBcS3v 6USwrAVD49Q91VdWL412Beuc1lh9luLsvseTAfwZXNQFTlfXj/44XL3QSDLO3kE477UK PuQisTQDtaTenLhmz9UxJrWIk76t/9C2sGl3AoIFTG0F/GG2DtEXlZsFxPta58HNNxGh nuotqk/EcRuGp6B6DpQqHvzB1OaU8/LVfrpsdfcpoHM2+LjVOOXNlq+MDZzMAY0XeOby XoS1N9oa25ZJEGOvTPLqpEaa/2bkazEZHcopiam72Y0TXS5KlF1vjQrUn3lGIfR4Oiwn FzZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690445172; x=1691049972; 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=hMz0NiXWW4aad/y0uXjwCFa/Ag/H17CXQFU4sIH/+zs=; b=C9zoDepvJ+kLxizUpb9iY/DKUaLVWaQebir7wgWdw1VuW76VSoXikixh/lwnPuXjqV ojQSGilCaoj6BHeLv+dmb17Rsp3Tr27L3pDszMBV4BTvZiLK2KGXsvNiVRnwpeIRT5HM zq6TeD/o2TsCdf+C86lyNEOwTMgFq55ILTovoo2ErIw2ogX69pjCZIMzrbx/TxE6ob4F 3UaLuvYErXp4lMoAggBaGtXTiMksp4m8yqDpBiKGwfQ+IUiE+M48m16Pop2Z4Svqdwvg 2w9DMrNpa7e6KcT7TydHZANqEo2ABlKd7K4aiPgMGhS3o16PCXaeWJnTFygq/w3KD9Ue R4YQ== X-Gm-Message-State: ABy/qLYpW5UVcPCuq+QnEIwIJJ5iNaFd+Q2BEXOE707g6rr8mCGBH/LX jgM1QVgs+QFEuYzshIseLZfPsg== X-Google-Smtp-Source: APBJJlELtr5cWJQ0To//AtRPEOYgFBMbhSo+p4MsXdX0IoPp5bJSVuIL2HKgeywTxbzsVW+qtVe8tQ== X-Received: by 2002:a05:6a00:4792:b0:668:834d:4bd with SMTP id dh18-20020a056a00479200b00668834d04bdmr4674312pfb.0.1690445172123; Thu, 27 Jul 2023 01:06:12 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id j8-20020aa78d08000000b006828e49c04csm885872pfe.75.2023.07.27.01.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 01:06:11 -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 Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, linux-erofs@lists.ozlabs.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, linux-mtd@lists.infradead.org, rcu@vger.kernel.org, netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-bcache@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org, Qi Zheng Subject: [PATCH v3 02/49] mm: move some shrinker-related function declarations to mm/internal.h Date: Thu, 27 Jul 2023 16:04:15 +0800 Message-Id: <20230727080502.77895-3-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230727080502.77895-1-zhengqi.arch@bytedance.com> References: <20230727080502.77895-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4ABE4100009 X-Rspam-User: X-Rspamd-Server: rspam02 X-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CTFSxNo/slbnHxxMzyog9reVYgU/beHno3aDvZOgulaZHHZIR31CRcCgGTpEId4jAphdQAhZckTw16D1jIJm4g8YQ4q8mRtmDZnPgrhfUlOtESi6P3fZYe03c54QleG3sm8EZd5QHmsqNMwe9moQ3RwnMKebwjaoFdehhIrf8zfq6A665SvpGU29ohSiohBnlpA/3hns5ytqqpKDp8ui+1UleyBZn6mE25tRez3rebNAxn/Hg6QCBiacGIfIMnWrkpJ0t6aOSa7A2o3zAvcc4jAyTW2uxEWY23n+wMdB9giTHyEd2+CkUcE3JXluDxcR177lyPy6rhEfPyvLrWlaMfLJY2Lo0O9aryviXb27PtMUuCMl4g/OYeOWZYHj5YM3V4GSrLv0hyLRA8kt 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 --- include/linux/shrinker.h | 19 ------------------- mm/internal.h | 28 ++++++++++++++++++++++++++++ 2 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 5a03bc4782a2..8aeaf16ae039 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1135,4 +1135,32 @@ 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 */