lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240826071036.2445717-2-lizetao1@huawei.com>
Date: Mon, 26 Aug 2024 15:10:34 +0800
From: Li Zetao <lizetao1@...wei.com>
To: <viro@...iv.linux.org.uk>, <brauner@...nel.org>, <jack@...e.cz>,
	<willy@...radead.org>, <akpm@...ux-foundation.org>
CC: <lizetao1@...wei.com>, <linux-fsdevel@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>
Subject: [RFC PATCH -next 1/3] mm: Support scope-based resource management for folio_lock/unlock

By introducing the DEFINE_LOCK_GUARD_1 definition, it is possible to
lock and unlock of folio's lock based on scope. At the same time, the
use of folio_trylock is also supported.

Signed-off-by: Li Zetao <lizetao1@...wei.com>
---
 include/linux/pagemap.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index d9c7edb6422b..ed1831c115cc 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -1537,4 +1537,8 @@ unsigned int i_blocks_per_folio(struct inode *inode, struct folio *folio)
 {
 	return folio_size(folio) >> inode->i_blkbits;
 }
+
+DEFINE_LOCK_GUARD_1(folio, struct folio, folio_lock(_T->lock), folio_unlock(_T->lock))
+DEFINE_LOCK_GUARD_1_COND(folio, _try, folio_trylock(_T->lock))
+
 #endif /* _LINUX_PAGEMAP_H */
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ