Message ID | 20240826071036.2445717-2-lizetao1@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 F159DC5321E for <linux-mm@archiver.kernel.org>; Mon, 26 Aug 2024 07:02:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 020D46B034D; Mon, 26 Aug 2024 03:02:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EEA758D0029; Mon, 26 Aug 2024 03:02:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D15E26B0351; Mon, 26 Aug 2024 03:02:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B06EC6B034D for <linux-mm@kvack.org>; Mon, 26 Aug 2024 03:02:47 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 69496A90D4 for <linux-mm@kvack.org>; Mon, 26 Aug 2024 07:02:47 +0000 (UTC) X-FDA: 82493503974.24.C0DCEC6 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf03.hostedemail.com (Postfix) with ESMTP id 3CA852000C for <linux-mm@kvack.org>; Mon, 26 Aug 2024 07:02:44 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of lizetao1@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=lizetao1@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724655702; a=rsa-sha256; cv=none; b=ZZzKcIO5cIKY/r0ZSCuRWC8foKiXmDzFqIzWvNuxJkgLqQNmxm26X09BuL3FKGH04agZSN WHek8+wSQheHxGu8v+ZexlQKO7dm4/5oNqeF1LVt35FOrumGOBGECLxNN92H+HWWjh6l1v XzJ8sjEMJ2lY0Tv9dSyroIP0TbjKq54= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of lizetao1@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=lizetao1@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724655702; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g8KB/rvBQQHioUECx2RXIz278sZny2ahR9UOpdiuK0E=; b=TIqCY5Tv17hzKgJs6IvvPbQtqcDvoozOft3GK0Wwl4CB9/dICi4eAbBAOnFuSLP5h9OE6o Sn+XG7JV1PABo4c4zML92N6oCulKABWJk8alm4/10qwyztzXMQWIcOuo085Wlgd4UhpuPQ KMz+JXKR9YEb/NpQolDuqdzVUK/ijAc= Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4WshSn3FMHz1j7JH; Mon, 26 Aug 2024 15:02:33 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id C6C851A0188; Mon, 26 Aug 2024 15:02:41 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Mon, 26 Aug 2024 15:02:41 +0800 From: Li Zetao <lizetao1@huawei.com> To: <viro@zeniv.linux.org.uk>, <brauner@kernel.org>, <jack@suse.cz>, <willy@infradead.org>, <akpm@linux-foundation.org> CC: <lizetao1@huawei.com>, <linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org> Subject: [RFC PATCH -next 1/3] mm: Support scope-based resource management for folio_lock/unlock Date: Mon, 26 Aug 2024 15:10:34 +0800 Message-ID: <20240826071036.2445717-2-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240826071036.2445717-1-lizetao1@huawei.com> References: <20240826071036.2445717-1-lizetao1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemd500012.china.huawei.com (7.221.188.25) X-Rspamd-Queue-Id: 3CA852000C X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 7q65raxzbqnrs988opijxyn7j53aok7n X-HE-Tag: 1724655764-222353 X-HE-Meta: U2FsdGVkX1/II6PtsVKCQ235DkHfa9EmauENF4Qli1IPmbm8ekw3m0d8lIm1WDc1A67JoMdGG5SsrSXlC94EXSbWOzDIOSEr2Y24xDcp2HBvEY/yQkeatzBsNqalFitMFOKoKn3aa4HA1BWq+aiFzymIQBXQv9GYYozOlRONBE6sEi3JjfSUfA87lbVun/QjCCx8hYqWtQUQfWvk2H1ETh4QRCO805BRsGGHHyifV0z3exBq0j1xTp/IRbJo34KvF3ZfU8dG/O5w0h7ULVueI9tZIBzZRP1Rh3Sin78OVW3SxEKKCUDOr8xwaUMQSimLVWv36fMWs0X4hjNuXRirsasx5Oy9q4+At0SCoukzWe75wbo3/SssBPiXrBQ9aS/bQLye01Gqoz3l4TmzCpBXQqKFWBcGyiVhpSTM6dtV/vDNB7KSORTFQOUQzG1UAhNLMZ0hwoi6eII5EGUqdGyqCEs8oRK9VJHjtMV5Is+YAiPgjpPzfTY4EBJrg+tbgbEPsliB1qLo9erquJgKyn1mXnepCjxh6Q39ZJCJMaS5fa5ASfva07PEa1VE7iJuQwjTUV6o+d9sS1i8O3WPM9fK8SIjnBKEQw3nrp2R9VtgW1bWy1vbyBSJlCSDfnqrEHS5ln7lSjyy6WaPwJ8w0MUsrf53fH1i+5MScImxGmoRseBWIJEdMsq+cZqHcmji3CCxzHE5JQHCx9qcgivD+jwnpO7s/7y7W1pSR15ocXuSUJw9oalP0QgQUsigGmSTchvWgxwJ/Hx/t9l/ins5MjtQmf9K9VvQUa+cRKHUx0l+fuiPF+IvA1MzyVKIS8e+FXcuxkm+eEIWmm0/hnnBiffAhTJWuSDj6OaAjqhFceQ3daLZowT0TSzq9h2jbBRYB6VqxfESdWZIkmblgmm9ol7juQWxdaoDWiqWhkfQHP0aYmP52HfFGMAdw49ZjGKAco4nYrFIbN9CnWsiPqnA8Bm nDMjWxWp kS4aO9EYFkTZSK/bU611eIRu9G/lC4csgyNutFtyrWUqhaCIDK6M5ynrrb2G7ZmlWpQEWquqqZScYi4Ms4mnS84tDZa2T/i3+xXiPRg9nLgkqrm1EAFXW9xI6zJp5XStEOXO6lkN/bGiqFzgf0EBFjU4720/MnEuE1pUDXsJhI88QahOz1zZVOqHX57g0s6qcWCL/ 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
fs: Introduce the scope-based resource management for folio_lock/unlock
|
expand
|
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 */
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@huawei.com> --- include/linux/pagemap.h | 4 ++++ 1 file changed, 4 insertions(+)