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: 13093004 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F91BC61DB3 for ; Mon, 9 Jan 2023 04:07:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236687AbjAIEGj (ORCPT ); Sun, 8 Jan 2023 23:06:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236689AbjAIEEa (ORCPT ); Sun, 8 Jan 2023 23:04:30 -0500 Received: from lgeamrelo11.lge.com (lgeamrelo11.lge.com [156.147.23.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E515811C37 for ; Sun, 8 Jan 2023 20:03:55 -0800 (PST) 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> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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; \