From nobody Wed Nov 27 10:38:01 2024 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 292631C2327; Thu, 10 Oct 2024 11:11:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728558676; cv=none; b=MJ3toSupDgTDbknQbXbVrMPXUEhPam2skK3L8SlKUW/wZmQIj3R/gE+sYxlh99WSOjB1cC0qP/aT8jEhVTMkmhYhfclc3Rp3HN1WDgXv5eT4wlBfkmh3bByvogJ2SpTt7YPWFxOMbNLlVld1wLvWg8P6ReNgm6VdjgiyNa1Fjz8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728558676; c=relaxed/simple; bh=LPBP+ydfXLjg4zx4fQ4vMwAgrFq3BvdyOwsW/lolDYw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=g7QelYEaSTS2NHI5HnQUNf/xBuxM62bYf6W7l56jrimdquGKdd/iG/jbPfzL2MbVs/Ur7nO3ZaVMg6eiryUeZqjSjCG+IQxM9Q4oUDmTGuQ0i9U3ctvgC4w16uT2I/uWtE49lewOdGX5ihr5Jqpvjtj7cYYFGRQBkggP2tnDZyk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4XPRrY6P8fz4f3jXK; Thu, 10 Oct 2024 19:10:53 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id BFCB31A058E; Thu, 10 Oct 2024 19:11:10 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgDH+sZMtgdnmHXPDg--.37048S5; Thu, 10 Oct 2024 19:11:10 +0800 (CST) From: Ye Bin To: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, yebin10@huawei.com, zhangxiaoxu5@huawei.com Subject: [PATCH 1/3] vfs: introduce shrink_icache_sb() helper Date: Thu, 10 Oct 2024 19:25:41 +0800 Message-Id: <20241010112543.1609648-2-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241010112543.1609648-1-yebin@huaweicloud.com> References: <20241010112543.1609648-1-yebin@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgDH+sZMtgdnmHXPDg--.37048S5 X-Coremail-Antispam: 1UD129KBjvJXoW7AFyrXFWrJr18CFykXw1xGrg_yoW8AFWUpF Z7JryfGr4rZ34q93savF1v934SqF4vvFWDGFy8Wa4Yywn8tryYqFn7tr13AFyFyFW8W39I vF4jkryUur48ArJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9Kb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUGw A2048vs2IY020Ec7CjxVAFwI0_JFI_Gr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV WxJVW8Jr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx 0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWU JVW8JwACjcxG0xvY0x0EwIxGrwCY1x0262kKe7AKxVWUAVWUtwCF04k20xvY0x0EwIxGrw CFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE 14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2 IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxK x2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI 0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvjxU7qjgUUUUU X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ Content-Type: text/plain; charset="utf-8" From: Ye Bin This patch is prepare for support drop_caches for specify file system. shrink_icache_sb() helper walk the superblock inode LRU for freeable inodes and attempt to free them. Signed-off-by: Ye Bin --- fs/inode.c | 17 +++++++++++++++++ fs/internal.h | 1 + 2 files changed, 18 insertions(+) diff --git a/fs/inode.c b/fs/inode.c index 1939f711d2c9..2129b48571b4 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1045,6 +1045,23 @@ long prune_icache_sb(struct super_block *sb, struct = shrink_control *sc) return freed; } =20 +/* + * Walk the superblock inode LRU for freeable inodes and attempt to free t= hem. + * Inodes to be freed are moved to a temporary list and then are freed out= side + * inode_lock by dispose_list(). + */ +void shrink_icache_sb(struct super_block *sb) +{ + do { + LIST_HEAD(dispose); + + list_lru_walk(&sb->s_inode_lru, inode_lru_isolate, + &dispose, 1024); + dispose_list(&dispose); + } while (list_lru_count(&sb->s_inode_lru) > 0); +} +EXPORT_SYMBOL(shrink_icache_sb); + static void __wait_on_freeing_inode(struct inode *inode, bool is_inode_has= h_locked); /* * Called with the inode lock held. diff --git a/fs/internal.h b/fs/internal.h index 81c7a085355c..cee79141e308 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -199,6 +199,7 @@ extern int vfs_open(const struct path *, struct file *); * inode.c */ extern long prune_icache_sb(struct super_block *sb, struct shrink_control = *sc); +extern void shrink_icache_sb(struct super_block *sb); int dentry_needs_remove_privs(struct mnt_idmap *, struct dentry *dentry); bool in_group_or_capable(struct mnt_idmap *idmap, const struct inode *inode, vfsgid_t vfsgid); --=20 2.31.1 From nobody Wed Nov 27 10:38:01 2024 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2920D1BE86F; Thu, 10 Oct 2024 11:11:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728558677; cv=none; b=SCUs/PNFvxfW5L+9sbYf/tqOFuKziSOoRLRsFmK1udUqEFIScWYKyYiXHDFS8m9vELAn7agtKUxjZKo2WJpfMp5s3QUZ9MSh4wTUCWQG8fjLSztqgnDwrqWx55mocipeB/AmPwepaCSXGNW6dJk8fwM4o6nram1yZas3u6KpROc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728558677; c=relaxed/simple; bh=IVBmOojz8e+eSyRyjC458ty1x3vr+17pkAfmkoicGVY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mSNvxu+erSWnUE6p+UpsBr6ARrPhEeZCpgVxa4OLMJFufiiSrnkBDr/1Ujugck2/6bELGV3HinoHtQLBr+xbMseAfoakovOUZ4iCjcFBFT/FnTsWsIiozulR+d5jiSK8TJdV8OckSkscmJAk0hKeQaKCX8kUWqtIfQlSYF0BvmA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4XPRrZ1ZLBz4f3jXV; Thu, 10 Oct 2024 19:10:54 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 1B8EB1A018D; Thu, 10 Oct 2024 19:11:11 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgDH+sZMtgdnmHXPDg--.37048S6; Thu, 10 Oct 2024 19:11:10 +0800 (CST) From: Ye Bin To: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, yebin10@huawei.com, zhangxiaoxu5@huawei.com Subject: [PATCH 2/3] sysctl: add support for drop_caches for individual filesystem Date: Thu, 10 Oct 2024 19:25:42 +0800 Message-Id: <20241010112543.1609648-3-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241010112543.1609648-1-yebin@huaweicloud.com> References: <20241010112543.1609648-1-yebin@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgDH+sZMtgdnmHXPDg--.37048S6 X-Coremail-Antispam: 1UD129KBjvJXoWxJw1fJryDtry3Gry7ZFykAFb_yoW5CF43pF W7ury5KrWruF12qr93CF4IyF4Sv3ykGF17WrZFg34Fyw47Ary0gr1kKryaqFyrtrW7uFW2 gFWDKr90g3y5XFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9Eb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUXw A2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMc Ij6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_ Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr4 1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK 67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI 8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAv wI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14 v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43ZEXa7IU89NVDUUUUU== X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ Content-Type: text/plain; charset="utf-8" From: Ye Bin In order to better analyze the issue of file system uninstallation caused by kernel module opening files, it is necessary to perform dentry recycling on a single file system. But now, apart from global dentry recycling, it is not supported to do dentry recycling on a single file system separately. This feature has usage scenarios in problem localization scenarios.At the same time, it also provides users with a slightly fine-grained pagecache/entry recycling mechanism. This patch supports the recycling of pagecache/entry for individual file systems. Signed-off-by: Ye Bin --- fs/drop_caches.c | 43 +++++++++++++++++++++++++++++++++++++++++++ include/linux/mm.h | 2 ++ kernel/sysctl.c | 9 +++++++++ 3 files changed, 54 insertions(+) diff --git a/fs/drop_caches.c b/fs/drop_caches.c index d45ef541d848..99d412cf3e52 100644 --- a/fs/drop_caches.c +++ b/fs/drop_caches.c @@ -77,3 +77,46 @@ int drop_caches_sysctl_handler(const struct ctl_table *t= able, int write, } return 0; } + +int drop_fs_caches_sysctl_handler(const struct ctl_table *table, int write, + void *buffer, size_t *length, loff_t *ppos) +{ + unsigned int major, minor; + unsigned int ctl; + struct super_block *sb; + static int stfu; + + if (!write) + return 0; + + if (sscanf(buffer, "%u:%u:%u", &major, &minor, &ctl) !=3D 3) + return -EINVAL; + + if (ctl < *((int *)table->extra1) || ctl > *((int *)table->extra2)) + return -EINVAL; + + sb =3D user_get_super(MKDEV(major, minor), false); + if (!sb) + return -EINVAL; + + if (ctl & 1) { + lru_add_drain_all(); + drop_pagecache_sb(sb, NULL); + count_vm_event(DROP_PAGECACHE); + } + + if (ctl & 2) { + shrink_dcache_sb(sb); + shrink_icache_sb(sb); + count_vm_event(DROP_SLAB); + } + + drop_super(sb); + + if (!stfu) + pr_info("%s (%d): drop_fs_caches: %u:%u:%d\n", current->comm, + task_pid_nr(current), major, minor, ctl); + stfu |=3D ctl & 4; + + return 0; +} diff --git a/include/linux/mm.h b/include/linux/mm.h index 344541f8cba0..43079478296f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3788,6 +3788,8 @@ extern bool process_shares_mm(struct task_struct *p, = struct mm_struct *mm); extern int sysctl_drop_caches; int drop_caches_sysctl_handler(const struct ctl_table *, int, void *, size= _t *, loff_t *); +int drop_fs_caches_sysctl_handler(const struct ctl_table *table, int write, + void *buffer, size_t *length, loff_t *ppos); #endif =20 void drop_slab(void); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 79e6cb1d5c48..d434cbe10e47 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2101,6 +2101,15 @@ static struct ctl_table vm_table[] =3D { .extra1 =3D SYSCTL_ONE, .extra2 =3D SYSCTL_FOUR, }, + { + .procname =3D "drop_fs_caches", + .data =3D NULL, + .maxlen =3D 256, + .mode =3D 0200, + .proc_handler =3D drop_fs_caches_sysctl_handler, + .extra1 =3D SYSCTL_ONE, + .extra2 =3D SYSCTL_FOUR, + }, { .procname =3D "page_lock_unfairness", .data =3D &sysctl_page_lock_unfairness, --=20 2.31.1 From nobody Wed Nov 27 10:38:01 2024 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63B031C232C; Thu, 10 Oct 2024 11:11:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728558677; cv=none; b=jFNziA7U4gRvLd+SlIapYFTWOgtirbhri+xXhEidXsXI2kIdxlx5L9xtDrLuzFPRuySngfqhvjx3c3INdhWTZE4GP0vRah8YiBhO9/OCYFYSDF+7Qb/hzf48bZvKfnUMBDXcTMhYhUslDjyeXbBfB/Q+sPMa14rHV9n6kGokZo0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728558677; c=relaxed/simple; bh=vBHTQ3ikgMDpFYYlH9F7zDQg4le2xfA5vS2Z0MoAwNs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uambZzOr/zxjr6UKexxtNHWCu6p0oKtAwkPw+AOGi1SKtqu04+/NFPj2uumr2IPX4ZIYTvVHtZdgKN+5RdIF5EAsdXNO3SF8kAU6VdqFS3V5AOmjmxj4CCCTdQ+mFBPw+eHRpAZcwyVB8H35ghIxlm6wEzAYw3yswJCYuPNag50= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4XPRrZ3y6Cz4f3jXb; Thu, 10 Oct 2024 19:10:54 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 6C5F61A0359; Thu, 10 Oct 2024 19:11:11 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgDH+sZMtgdnmHXPDg--.37048S7; Thu, 10 Oct 2024 19:11:11 +0800 (CST) From: Ye Bin To: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, yebin10@huawei.com, zhangxiaoxu5@huawei.com Subject: [PATCH 3/3] Documentation: add instructions for using 'drop_fs_caches sysctl' sysctl Date: Thu, 10 Oct 2024 19:25:43 +0800 Message-Id: <20241010112543.1609648-4-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241010112543.1609648-1-yebin@huaweicloud.com> References: <20241010112543.1609648-1-yebin@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgDH+sZMtgdnmHXPDg--.37048S7 X-Coremail-Antispam: 1UD129KBjvJXoW7CrW3Gw18ZrWfJF1kCFy7GFg_yoW8Zr1UpF ZrAryIgw18XFyxGryfAry7tFySvay8JFWaqas29r1Fv3ZxC34qvrnFyF1YqFy7GFW8C3yS qrZ8tr90gw1qyaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9Eb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUWw A2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMc Ij6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_ Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr4 1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK 67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI 8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAv wI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14 v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43ZEXa7IU1ByIUUUUUU== X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ Content-Type: text/plain; charset="utf-8" From: Ye Bin Add instructions for 'drop_fs_caches sysctl' sysctl in 'vm.rst'. Signed-off-by: Ye Bin --- Documentation/admin-guide/sysctl/vm.rst | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Documentation/admin-guide/sysctl/vm.rst b/Documentation/admin-= guide/sysctl/vm.rst index f48eaa98d22d..4648ac1ac66c 100644 --- a/Documentation/admin-guide/sysctl/vm.rst +++ b/Documentation/admin-guide/sysctl/vm.rst @@ -36,6 +36,7 @@ Currently, these files are in /proc/sys/vm: - dirtytime_expire_seconds - dirty_writeback_centisecs - drop_caches +- drop_fs_caches - enable_soft_offline - extfrag_threshold - highmem_is_dirtyable @@ -268,6 +269,32 @@ used:: These are informational only. They do not mean that anything is wrong with your system. To disable them, echo 4 (bit 2) into drop_caches. =20 +drop_fs_caches +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Writing to this will cause the kernel to drop clean for a specific file sy= stem +caches, as well as reclaimable slab objects like dentries and inodes. Once +dropped, their memory becomes free. Except for specifying the device numbe= r for +a specific file system, everything else is consistent with drop_caches. The +device number can be viewed through "cat /proc/self/montinfo" or 'lsblk'. + +To free pagecache:: + + echo "MAJOR:MINOR:1" > /proc/sys/vm/drop_caches + +To free reclaimable slab objects (includes dentries and inodes):: + + echo "MAJOR:MINOR:2" > /proc/sys/vm/drop_caches + +To free slab objects and pagecache:: + + echo "MAJOR:MINOR:3" > /proc/sys/vm/drop_caches + +You may see informational messages in your kernel log when this file is +used:: + + echo (1234): drop_fs_caches: MAJOR:MINOR:3 + enable_soft_offline =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Correctable memory errors are very common on servers. Soft-offline is kern= el's --=20 2.31.1