From patchwork Mon Jan 9 03:33:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungchul Park X-Patchwork-Id: 13092894 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 D688CC5479D for ; Mon, 9 Jan 2023 03:34:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A6835900008; Sun, 8 Jan 2023 22:33:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 774E78E0006; Sun, 8 Jan 2023 22:33:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBA6194000A; Sun, 8 Jan 2023 22:33:58 -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 ABA278E0007 for ; Sun, 8 Jan 2023 22:33:57 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 6C33B804AA for ; Mon, 9 Jan 2023 03:33:57 +0000 (UTC) X-FDA: 80333841714.12.64D2010 Received: from lgeamrelo11.lge.com (lgeamrelo11.lge.com [156.147.23.51]) by imf19.hostedemail.com (Postfix) with ESMTP id 4AEA41A0003 for ; Mon, 9 Jan 2023 03:33:54 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf19.hostedemail.com: domain of byungchul.park@lge.com designates 156.147.23.51 as permitted sender) smtp.mailfrom=byungchul.park@lge.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673235235; 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=270zbFTQ05jAjDFnkA2neyOIbVaY/1sep170CO2UC+o=; b=wrEbwUr4Mrgy8f6YQe2g7YZgT2Fjcy5N8BsFVEyo58Yk1Pjhsx+coQTDFONFSFJ1glPYzu YCzvVy3STjT0T0SxpJ5DQ6YmHkVg7NyGNXrK9jCF2WzENlEAaVs4RcZAuHACyxBq5T8g/U 3V2ME1bknLoqLI2EsGGWWqwPupAsO6Y= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf19.hostedemail.com: domain of byungchul.park@lge.com designates 156.147.23.51 as permitted sender) smtp.mailfrom=byungchul.park@lge.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673235235; a=rsa-sha256; cv=none; b=8MLCwagYFCcvpXfDr6eCL9NLjGN4rPLli4aVm234Ep/qtn1lDofvmfIoBwNFNGiX7fajkz tsS0GPDNgg6A+Z3poAV0sOrRKwDpz8wSkEnQGMtBJ2m7xWqibjkcLLi4njRzZUMMZtzfk5 me7zhAT07g8Y1HGi21GTVXwdat9XNMw= Received: from unknown (HELO lgemrelse6q.lge.com) (156.147.1.121) by 156.147.23.51 with ESMTP; 9 Jan 2023 12:33:54 +0900 X-Original-SENDERIP: 156.147.1.121 X-Original-MAILFROM: byungchul.park@lge.com Received: from unknown (HELO localhost.localdomain) (10.177.244.38) by 156.147.1.121 with ESMTP; 9 Jan 2023 12:33:54 +0900 X-Original-SENDERIP: 10.177.244.38 X-Original-MAILFROM: byungchul.park@lge.com From: Byungchul Park To: linux-kernel@vger.kernel.org Cc: 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, paolo.valente@linaro.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 Subject: [PATCH RFC v7 18/23] dept: Apply timeout consideration to wait_for_completion()/complete() Date: Mon, 9 Jan 2023 12:33:46 +0900 Message-Id: <1673235231-30302-19-git-send-email-byungchul.park@lge.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1673235231-30302-1-git-send-email-byungchul.park@lge.com> References: <1673235231-30302-1-git-send-email-byungchul.park@lge.com> X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 4AEA41A0003 X-Stat-Signature: j3yqkwtfyy883n7zt747zdquxgbt3mq9 X-HE-Tag: 1673235234-292586 X-HE-Meta: U2FsdGVkX19PRdsNGuXYY+1WX/AwImDbacZm4K2UNzdWSN7vgZt46dX+oEXivAhutlNqHgzw2aUMLTTzPnX9xUtFLiloFmn6eUMk5o5kOGNEREmOhvcyLYvwRMeOX7V3PQGmXiLJbA4Op5YQ9+fB29Ne38JyuhWFagN8DjucI+9uGdgcQfvNRgZ34GSAbjjv/UW4KlUmH1YWPI5pzuxnN/XEY88iU4lD6+7UGjVHnbQjx5HI3x+xo5RFP6v2H9t3+SzMvGnoRBBlsXHUfl4U9Ex4mIS7uA5a1AOqOyVSpKYm/WssZuc2kcCN7okc+Ch+NF4kkyVX0CHWLL8KYnHJy3w6yPhonCjhFDk2b2Z3xJnJiHk8cOt6Wv5At+x9xUPNH7SZxNJ8ATUSzw3h2XW/hcEQrQC/WMk87lArDULQatB/q8ERqi4IZwP//xQYgSHvby4OmttaP8q+zP5MGi6m2Na/ULzqVC2VwpWtsa5G1H4IkT0AmzhtEcN7zuKktPwmNm8mPBzPJUDeS7Xk0fuT83MJJoV3zXDn+cLMUDWPoaR28WmOh5VqHmUvlS5i8bF4xsP49ecUlzKQWJ/+iDGhu2VyNQYOdBSUSUZl2pftbJRCYQP2YzSmZpSAMuPtLkX1UqfAdKSYYa3w7lehxw2LseskjT9htEp9DuhC/fjpJhKNF/QS+5jENcUcCcQb+KylvfrE8SlAnmikG10i3Q/uIB5WxyWi4rDZXlTVReJkug6qvAtvBFKkKIFaD/96tMjuC1UxMoB3rz1tIxko8NrkNJrXN0T9hNlKNoAqQBZfz2gPzkIzQeb2VGgra18z97v0MiO61QC2cxfAOJ5BVjkh6l50G81QZ1X6Lg7Rpx9yYl7EvL5M3HmBuyImxOHEIxWn 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: Now that CONFIG_DEPT_AGGRESSIVE_TIMEOUT_WAIT was introduced, apply the consideration to wait_for_completion()/complete(). Signed-off-by: Byungchul Park --- include/linux/completion.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/include/linux/completion.h b/include/linux/completion.h index 0408f6d..57a715f 100644 --- a/include/linux/completion.h +++ b/include/linux/completion.h @@ -11,6 +11,7 @@ #include #include +#include /* * struct completion - structure used to maintain state for a "completion" @@ -153,7 +154,10 @@ extern long raw_wait_for_completion_killable_timeout( #define wait_for_completion_timeout(x, t) \ ({ \ unsigned long __ret; \ - sdt_might_sleep_strong(NULL); \ + if ((t) == MAX_SCHEDULE_TIMEOUT) \ + sdt_might_sleep_strong(NULL); \ + else \ + sdt_might_sleep_strong_timeout(NULL); \ __ret = raw_wait_for_completion_timeout(x, t); \ sdt_might_sleep_finish(); \ __ret; \ @@ -161,7 +165,10 @@ extern long raw_wait_for_completion_killable_timeout( #define wait_for_completion_io_timeout(x, t) \ ({ \ unsigned long __ret; \ - sdt_might_sleep_strong(NULL); \ + if ((t) == MAX_SCHEDULE_TIMEOUT) \ + sdt_might_sleep_strong(NULL); \ + else \ + sdt_might_sleep_strong_timeout(NULL); \ __ret = raw_wait_for_completion_io_timeout(x, t); \ sdt_might_sleep_finish(); \ __ret; \ @@ -169,7 +176,10 @@ extern long raw_wait_for_completion_killable_timeout( #define wait_for_completion_interruptible_timeout(x, t) \ ({ \ long __ret; \ - sdt_might_sleep_strong(NULL); \ + if ((t) == MAX_SCHEDULE_TIMEOUT) \ + sdt_might_sleep_strong(NULL); \ + else \ + sdt_might_sleep_strong_timeout(NULL); \ __ret = raw_wait_for_completion_interruptible_timeout(x, t);\ sdt_might_sleep_finish(); \ __ret; \ @@ -177,7 +187,10 @@ extern long raw_wait_for_completion_killable_timeout( #define wait_for_completion_killable_timeout(x, t) \ ({ \ long __ret; \ - sdt_might_sleep_strong(NULL); \ + if ((t) == MAX_SCHEDULE_TIMEOUT) \ + sdt_might_sleep_strong(NULL); \ + else \ + sdt_might_sleep_strong_timeout(NULL); \ __ret = raw_wait_for_completion_killable_timeout(x, t); \ sdt_might_sleep_finish(); \ __ret; \