From patchwork Thu Aug 17 11:23:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13356255 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 29F2FC27C7A for ; Thu, 17 Aug 2023 11:24:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6915C280037; Thu, 17 Aug 2023 07:24:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 64173940020; Thu, 17 Aug 2023 07:24:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4BB74280037; Thu, 17 Aug 2023 07:24:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 37539940020 for ; Thu, 17 Aug 2023 07:24:33 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 07D95160432 for ; Thu, 17 Aug 2023 11:24:33 +0000 (UTC) X-FDA: 81133363626.21.8E51041 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf24.hostedemail.com (Postfix) with ESMTP id 19D8718001A for ; Thu, 17 Aug 2023 11:24:30 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=QPrroukD; spf=pass (imf24.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.176 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=1692271471; 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=Edkj9TBH9r1yTrwiI2mq64ByzXZznvLaEK+Zi+OSIAs=; b=wsUsBzcGqAaCgb1+szD3JJVDDBSc16f9nXOYc4pZN80sx72EbNzE8UtPgS0N1E9ovVE9xp By7ek2D9Mm85NrTwMwBL1gmtVzgD+HHL5WHKnBM3YTgwkcZaJQf8xq/xSFMNueoZwwEcNc 0HJOtsLZv2X30FJQnTa0PbfTiKkBv+M= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=QPrroukD; spf=pass (imf24.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692271471; a=rsa-sha256; cv=none; b=tj/jY6/PZek3hHeqRVsGV106KEv/lywyCcnWnkxb7baf9S9Y57cbizIWlFuu/Sr051cK8F aeQQDCh033+C+MxjwR0z0VivJ9uU9tc0H6nBuyvuNKjl8RhioZCmht1EztRm9pdXTgwSnV YDafsZWOSe5n/90TOY3DXkBpW75nB08= Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1bf095e1becso1550235ad.1 for ; Thu, 17 Aug 2023 04:24:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1692271470; x=1692876270; 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=Edkj9TBH9r1yTrwiI2mq64ByzXZznvLaEK+Zi+OSIAs=; b=QPrroukD/0sUYTrperpoi4k0+O1FkEFMssCKpRI8fMzWjYWPc1C5njqyG2p1lDvG8X HsOoOZkoy8V0FkWtMQFLoIbhtQ4Y/buM4M3hV+jvWn0vx5yIwLW3bIoUFjLtbjg4liVi 8iUPW54HVtYwd8swxQ4P7EcjEabvnc3On0Wf3MpqJfeIlBtjexBIW8RZv9T7kLftiBfe TiABJzV4xgR+Cqa18qjOcrHDQj2Y7Y8AuUREUchQrolVO18tA1srYXpq0JiFzQ18tMjx YQ7ehb4AsmQaiW2z/cJ9uEI7MgIJa3wNkH2UbGSKGqRZyiN3qecKnYz7Eo+IRyCh0r9S VYqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692271470; x=1692876270; 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=Edkj9TBH9r1yTrwiI2mq64ByzXZznvLaEK+Zi+OSIAs=; b=B5HytPg+/auZHjmyKudRSXM1NS/zBamLNbfVutuRfjvbHDPJ6KrlCQPhNLhbOZ+dZg MuRUrUDkv3LhCqdEu5aObB7h8vs7ZcaAgK5h51EV8y2c5zcxsqPX2MHl6CNUo+/Dj62O 7hVg/e1mJd7bQn8fHhP4ZGqJtIAQIU1IU2XBX+04p8OqgugBjuuvCXXXdz3VfqHqZLS/ /YQx+fgHcNmPjMSEgf6Id5VeOAZ8CVRwM0ut8n3Em4DWjFX4qbsTmE0AsShetMTnbIT0 RVAIO877t/qtPquiXwygG4gwgNVdiYbxvPj/2LNp+/gWdHcccuYcU7FG+/noFjar0Tk4 uN8Q== X-Gm-Message-State: AOJu0Yy9Mlh+pzP4gXfdU8emR+7sJYnoTYM8DRj7q9kHRtgkbzgl8OiF knAlYeQ9+gDbO6hzKznm4pgF3A== X-Google-Smtp-Source: AGHT+IEJtYhqVgPFBx2Uc3KOT9HxMzyHVti3q5fR4hRNX0J6IpAnsXg7OHEkf7BAe2qVXVwECCkiew== X-Received: by 2002:a17:902:da91:b0:1bb:b832:4be9 with SMTP id j17-20020a170902da9100b001bbb8324be9mr5398982plx.1.1692271470090; Thu, 17 Aug 2023 04:24:30 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id jd22-20020a170903261600b001bde877a7casm7229309plb.264.2023.08.17.04.24.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Aug 2023 04:24:29 -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 v2 1/5] mm: move some shrinker-related function declarations to mm/internal.h Date: Thu, 17 Aug 2023 19:23:58 +0800 Message-Id: <20230817112402.77010-2-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230817112402.77010-1-zhengqi.arch@bytedance.com> References: <20230817112402.77010-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 19D8718001A X-Rspam-User: X-Stat-Signature: xdrgrrcjf6h7c1drsuywyryrwcz9ncpn X-Rspamd-Server: rspam01 X-HE-Tag: 1692271470-39725 X-HE-Meta: U2FsdGVkX19IYlJYrs+vcNwlUypwOTJ77aWGu02g2SjXT5morc05A6t9cXkH06eJehIpEBrPCj1mzxqrdi9wzJHWqefbC0+vplepyhmb0KgyYyv0yHQd+gYCXDh3pi7B2j9FKnQDfxDxOOCxEJXfPKpULf0w8PBaJOP3GCrhDSJqhq59QGKP9q112DFDT3mpHU8Cvep9FXi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vdhfxyzmyqujAJGFiDdbN8klUsQ6tDJSx+3JK7wwfdUa2P1ws6UlkiqTrghXAmCdcvSUX0REiiY0ADA7HDp04p0YHilYbYDTty+9aPcON3+Z6n0AwgF7fXXsGo83FfdQpST9x8tsthGtFhZXgCjWC0Ov5ZyTvFEvCyQNtQwaL2L1H0jy0tJ+Vtpc= 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 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 */ 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;