Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5660933rwl; Sun, 8 Jan 2023 20:08:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXsg3wXOykCE9MGnam3UAoK1K2TWJwAnd4W4DAAhKMgkTa6849Yrtepnq/kcFibellJtRL+3 X-Received: by 2002:a62:8408:0:b0:575:d06d:1bfa with SMTP id k8-20020a628408000000b00575d06d1bfamr68196810pfd.2.1673237299090; Sun, 08 Jan 2023 20:08:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673237299; cv=none; d=google.com; s=arc-20160816; b=uYj5nNuSTwTqon53l+WyEyDiixMMQaep5d0ybU/buFuElC+A9SNdrOyFAi4OXC1ZyI ikrTf0bYZZuxpPZi0vgod/C47VpN/4xoiACx7t7SDf6E1V98FP4I1dMFom1DvSsHrdST Gabu5REQsLQt7DYP2xibGA9MuqxnOMci5LeSQtGMcMDCsng7gTDnKJD+lX029ttnzhmP oUI/X/RJEZ4ARNAnLfqznZ+UwQgydA5FKHPv3AyvImvDuE6rJBoBjbIAiDbS8dPpE2vo S6w1GKerjGfzodnYRAleT3ZMVm0/AnXeKJVA0Zkp2oTiDzcMS7lE/lawEo7GIRHBCCQC dygg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=270zbFTQ05jAjDFnkA2neyOIbVaY/1sep170CO2UC+o=; b=DZR3IDaGbMhb3SDmBye6V/yCOP5jAMYSZ2FJJLuCgzNh3t6QaniXVHJ1P2NuTU07ma oIVZy3KuFdScCMhbiB1nRQW0rwbbGAQqcSUExjTK4Qxb7yCxkYth9tCvvSLJ3siuNxyu xrOilpw05H+5VM40eyY/+nwLw+qhDHpjPBb3qltn3CmftkXn8IBkkWf6SQiNK86JBaJ8 JNkbQI5NCM3PG3rGx4rL/vjWvNfufDgvxHteHsftV4OgWIxXF94fLhkwgbXMjFBXavd8 9oNbw/ozCWoPqpAdPC12hlW7Zc/cDvitp0AZIh1qER8XzmVsjEiBe4CQhAN8lkV4Bgg8 3RHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c8-20020aa78c08000000b005786897553bsi8093823pfd.39.2023.01.08.20.08.03; Sun, 08 Jan 2023 20:08:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236502AbjAIEGF (ORCPT + 99 others); Sun, 8 Jan 2023 23:06:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236443AbjAIEEa (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 E7C4911C31 for ; Sun, 8 Jan 2023 20:03:54 -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> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@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; \ -- 1.9.1