From patchwork Wed Jan 24 11:59:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungchul Park X-Patchwork-Id: 13529073 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 669A5C47E49 for ; Wed, 24 Jan 2024 12:00:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 891078D0002; Wed, 24 Jan 2024 06:59:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7EF896B008C; Wed, 24 Jan 2024 06:59:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 690B08D0002; Wed, 24 Jan 2024 06:59:59 -0500 (EST) 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 56DFE6B008A for ; Wed, 24 Jan 2024 06:59:59 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2199C16038C for ; Wed, 24 Jan 2024 11:59:59 +0000 (UTC) X-FDA: 81714060918.07.3FAE05E Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by imf27.hostedemail.com (Postfix) with ESMTP id 3E97A40003 for ; Wed, 24 Jan 2024 11:59:56 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706097597; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=BveDZXyUi+0KphJCZYH/lpxdeY6rjC9WhIaqxXlaGMI=; b=H+YwUJFy5uwWn/omcq81HMjqB7dbTsxO2M17Ugtd4JfbosjWWKIQxXlznTw1hbiTWRJK55 w0VvkSFjphGWVm9ztl30G44DFDFzofFuqfWI/JiKQBheS8i/KgJS5rtldd8vbcOJ3agcqf +zwtbSep8sGCAaQ3cN/judQUYj9PWkg= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706097597; a=rsa-sha256; cv=none; b=ebiusseBZNEFn8qpqeV81SeUgaqpmw1CZ91g7reHLgsVKa3uZXMo6LiV8HbcalDuDsTiXB mFBFVJdp1tlKkxvwo7Jh7NlsSpOouJEUBmcn/UhxurDios5ZFS/0n9V2Wo3hu4nRiXDOVw lXzeXlM6aKJTA3SCBYtGqo5no6Vgz8w= X-AuditID: a67dfc5b-d85ff70000001748-b5-65b0fbb512f0 From: Byungchul Park To: linux-kernel@vger.kernel.org Cc: kernel_team@skhynix.com, torvalds@linux-foundation.org, damien.lemoal@opensource.wdc.com, linux-ide@vger.kernel.org, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, will@kernel.org, tglx@linutronix.de, rostedt@goodmis.org, joel@joelfernandes.org, sashal@kernel.org, daniel.vetter@ffwll.ch, duyuyang@gmail.com, johannes.berg@intel.com, tj@kernel.org, tytso@mit.edu, willy@infradead.org, david@fromorbit.com, amir73il@gmail.com, gregkh@linuxfoundation.org, kernel-team@lge.com, linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@kernel.org, minchan@kernel.org, hannes@cmpxchg.org, vdavydov.dev@gmail.com, sj@kernel.org, jglisse@redhat.com, dennis@kernel.org, cl@linux.com, penberg@kernel.org, rientjes@google.com, vbabka@suse.cz, ngupta@vflare.org, linux-block@vger.kernel.org, josef@toxicpanda.com, linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, jlayton@kernel.org, dan.j.williams@intel.com, hch@infradead.org, djwong@kernel.org, dri-devel@lists.freedesktop.org, rodrigosiqueiramelo@gmail.com, melissa.srw@gmail.com, hamohammed.sa@gmail.com, 42.hyeyoo@gmail.com, chris.p.wilson@intel.com, gwan-gyeong.mun@intel.com, max.byungchul.park@gmail.com, boqun.feng@gmail.com, longman@redhat.com, hdanton@sina.com, her0gyugyu@gmail.com Subject: [PATCH v11 07/26] dept: Apply sdt_might_sleep_{start,end}() to wait_for_completion()/complete() Date: Wed, 24 Jan 2024 20:59:18 +0900 Message-Id: <20240124115938.80132-8-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240124115938.80132-1-byungchul@sk.com> References: <20240124115938.80132-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSf0zMcRjHfb4/r+P4OjbfmLFbzWQkqj3MLGbzMT/G/GMYjr5zN3XlUmQz 3ZVECllOP3CVnXMd5XvHUHGyUlEdtZyWVimkn0vXnBJ3mX+evfa8n+f111tCyp/R8yVqzQlB q1FGKRgpJR2YUbD80XipsFKfFgJXL60E92gaBfklVgacD4oRWO06AnqrNsOHsX4E4/WNJBiy nQgKOj+RYK9uR1Bh1jPQ1D0Tmt1DDNRmpzOQXFTCwLu+CQLarmcRUCxuhzdXCglweL5SYOhl IM+QTHjHNwI8JgsLpqRA6DLnsjDRGQK17S00VLQug5xbbQyUV9RSUP2ki4CmZ/kMtFv/0PCm uoYC59UMGu4PFjLQN2YiweQeYuG9w0hAaYpXlPpjkobXGQ4CUu88JKD5YxmC52kdBIjWFgZe ufsJsInZJPy6W4WgK3OAhXOXPCzk6TIRpJ+7TkHj79c0pLSFwfjPfCZiLX7VP0TiFNtJXDFm pHBd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A0KX7wsKp7BEWLp/UIcg6dZGChp/PaEjviILR7wVMzDJc1T9I4vSy w9jmMVD4uZHHD/Lfsjj9cTuLDdZDuMwchq9X9BK4cMhNY6vlDIOtQxdYfPZLM4EH6utZXJM3 SuHuZj2xYdp28fLdglKhEVQLVsSJ452uHvrgk6Aj3l8nUlB54FkUIOK5xbyuPpX2M8PN4Vtb R0g/B3Oz+DLtB18uFpFcxlje/LWO8RcTuHi+vb73L1NcKG+0lyM/S7govuJJEf1POpMvKrX/ FQVwS/hbl9opP0t9m/eWc+x5JDagMRYUrEjUJMgVyqhw9f745ETFkfBdBxKsyPczpuPenPto uCm2EnEiJBsnibGUCFJarlEnJ1QiXkTKgiWtU24LUsluefJRQXVgp+qQUlBXoqkiSjZZsnqL ECfl9sqThP2CcFBQ/W8JUUBICnrp6O/RGHuCFk3qyIyMvLYmfPqMb9vr5IPad66W2d4b27QZ A8c6dVWRXbiPHaOmYuduLgyKvjmnbV/a8zzb1GhPd/6E8dGf25I2vfjpqandOm+NO+Pum2sT d3wtiWswOp5+3rQyIkDfY1pKdt9TV6buWaWhlGsdoYaEjTG2sKEQ3bCMUsfLF4aRKrX8D8Uv ZDsvAwAA X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 3E97A40003 X-Rspam-User: X-Stat-Signature: fugdk7o3io7963rxokmbrg845dcfqkuk X-Rspamd-Server: rspam01 X-HE-Tag: 1706097596-511756 X-HE-Meta: U2FsdGVkX19jmLBjPi/KAL/GMeyKpCR6m4naV/9rSe5CJGzymdIsJes7g8BEfEmga9xipJ4tchs0vRKo3pojM/JrwkXgmjhBnwBCnO5siS/gtxppKo/1Cgjpe0HRK84ABLrNavpON4kDKqzQGXbl4QmCuMKx/xrC6K/cuRQtAEj2wMnkU7gR4AHSrpv0urXecvdpZixYkUoosqJvIPptv7sO4i/ouNa2XUzJT5LZ0kjYMA/lE8CwvQ77j+p/5prfAxLvy6kxLMmvjjXDQGupyDrHWkSuQpd4VPsqjm4SbdhABvIqDyEnWOwu83AfChScDP013Y1qkqp07MgT2mCH0GeMmqWSYfmVG6kf9xM7RhR/+GVzyU0nt1gGrNAOlUuzpWebSEHGaHk92qtWD8+dnzOk+lPZsW/z07V8WL1K5ZrXwZMd1BoYunvGKQvvIsHkW5lBZ2DDivbnkL3bFFtDZjhMZGsKj4c9mH2MSKX3lGj03OiiFVyqAWC7qfkHyTn55YxMU+5x0HrpBk3wj+dR7fywJphEuuOS6CmmVYfE3i3do93IlVrvX8XVzzn3bRKpwfz9mFTbD9F6V7TIDU57wnl67sPqQ8WMK4gZs29SEjyzrF8TPmbIHgtGCAl85iNyLns9N/KAeWv1vuHjwePFZFLr4FS0lg+FObhLHCVO3iASsS6sjFH0JA90ecPvADjjGBxzTtzkFGDnT8WxVqyAfikoU7az22VKxIqRO5fCDXGjIaQFZuzmCNeeJLBbBcduLAxwRAOzd0e+mmEfGvliUPbVZ0T07erjYW5zS2ps+17E0j8c0KS1ZCtb6aEDMopGZS2hc8ahnG6flzyACR4Ax2gclbNLuubbFGtMzLkAdtJSdwvk6mRe3qTeYGFB1j+wvFsDLyFTr3LFoMkE5dIb5JZlgxV1tzm3mp+2e70IW1qndBy+E01Hx97vjMRuIQO0BHetQTg2u47q4hNaCAJ xYCoE1JJ Zc2xX063W0lStY7+Si9xdKsZ+SkkG9lfYj/Zdq0iyZfrY2H2Srga39XLR3ne3KGmRFMZxDWQrm/nWoaDeQDijiBiP9SVgHNzXtBvBvTIBpzA1v0M= 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: List-Subscribe: List-Unsubscribe: Makes Dept able to track dependencies by wait_for_completion()/complete(). Signed-off-by: Byungchul Park --- include/linux/completion.h | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/include/linux/completion.h b/include/linux/completion.h index fb2915676574..bd2c207481d6 100644 --- a/include/linux/completion.h +++ b/include/linux/completion.h @@ -10,6 +10,7 @@ */ #include +#include /* * struct completion - structure used to maintain state for a "completion" @@ -26,14 +27,33 @@ struct completion { unsigned int done; struct swait_queue_head wait; + struct dept_map dmap; }; +#define init_completion(x) \ +do { \ + sdt_map_init(&(x)->dmap); \ + __init_completion(x); \ +} while (0) + +/* + * XXX: No use cases for now. Fill the body when needed. + */ #define init_completion_map(x, m) init_completion(x) -static inline void complete_acquire(struct completion *x) {} -static inline void complete_release(struct completion *x) {} + +static inline void complete_acquire(struct completion *x) +{ + sdt_might_sleep_start(&x->dmap); +} + +static inline void complete_release(struct completion *x) +{ + sdt_might_sleep_end(); +} #define COMPLETION_INITIALIZER(work) \ - { 0, __SWAIT_QUEUE_HEAD_INITIALIZER((work).wait) } + { 0, __SWAIT_QUEUE_HEAD_INITIALIZER((work).wait), \ + .dmap = DEPT_MAP_INITIALIZER(work, NULL), } #define COMPLETION_INITIALIZER_ONSTACK_MAP(work, map) \ (*({ init_completion_map(&(work), &(map)); &(work); })) @@ -75,13 +95,13 @@ static inline void complete_release(struct completion *x) {} #endif /** - * init_completion - Initialize a dynamically allocated completion + * __init_completion - Initialize a dynamically allocated completion * @x: pointer to completion structure that is to be initialized * * This inline function will initialize a dynamically created completion * structure. */ -static inline void init_completion(struct completion *x) +static inline void __init_completion(struct completion *x) { x->done = 0; init_swait_queue_head(&x->wait);