Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp807006lqb; Wed, 17 Apr 2024 11:12:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW5+yBieQaniPSCWjvwirz7eMbb0jR1IYQA4Xv/cBlkPdyxCnt2w11DVclFgBol/JJ6tte3+CbVekMqi7GndWlAeR/TCCoZyMvOcQ6mpQ== X-Google-Smtp-Source: AGHT+IGqD5kT8CXNxHA77y/Zs2RFWbFHFoCiGyKh3MsXPy7H0tER2WI5F6K3BVHhQxpelv0z0Aaj X-Received: by 2002:a05:6a00:10ca:b0:6ec:eacb:ecd2 with SMTP id d10-20020a056a0010ca00b006eceacbecd2mr406690pfu.33.1713377521647; Wed, 17 Apr 2024 11:12:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713377521; cv=pass; d=google.com; s=arc-20160816; b=m3vgtHrO9JAJLjcJKiGWL7qA+Mh39lG6Xg/Cf6k1Gq3c8yF9V20x3/WEI1gxCENLjB LHEipcnFc5MEQb7Q5nVs2RJ1M8yBumAt67folvZQqMIp8DZXmpbs0JcR9s1e4RToYuB1 GBu/ya9AyCOV26X/BW13Z71DEWUZuUq2m9+hdFok4qMEvLecd05arH9hxt1hqPhssym8 hWpsoxtUKdz3KyhLlu3Q2nWrGtT4yyfC92zZOU4E4Ceoa8Dmi0oRT7fcMAfX2HXJ2EDj Vza6qfoOwsgPJXmH5+7VHq3A4lwlxtVEB0xTqqQKkDX1Sp1xvv1iTHb53iiV/YTeZv4z ZJEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=4CqEU9pkrruCGPgaK3aKCqLwJU0gMOcZXnjX2G2B4QE=; fh=2nfiaBMObd9U4Wwpe7suc3kBhxICW2tqiCh//1d2IcU=; b=Zon4sf31Movs/M3A8yBthe8c4G7cKif+63f4hRGJc66vNNVaX5hWNcEDGXU6w1azre Fj/y2AP0FdQmeotnZO69+SQNycc8b+UM76ed5N/KfXhCF5jSOwJozopjHPYO9iqqy0s9 gPG8kWYruX1yv/DPCjybjKXEwHtHKoWlwg2R72vVIg7HhC2rvHa7Q81qq9E9AGUOBoxC 68Hhb63gyz1QrlT1jcanay59bll9pS3M5sqF1vleLUN6Yyu22nHx6CDJrUNYbLEpJNc2 fqgsApSCujOXd4OMFhat92/I7Oh5yXQVyHVzhOYGmvicLZRSoMI8CcizaNfBj5+ruas3 efVQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="g9K/RXMI"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-149026-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149026-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bs64-20020a632843000000b005e42b4c97f2si11642660pgb.289.2024.04.17.11.12.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 11:12:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149026-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="g9K/RXMI"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-149026-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149026-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D8B65B22812 for ; Wed, 17 Apr 2024 18:00:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC838172BCF; Wed, 17 Apr 2024 18:00:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="g9K/RXMI" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60ACE172BC6 for ; Wed, 17 Apr 2024 18:00:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713376829; cv=none; b=HT6nTQeBfRHU/lekMU9nKR3Wd5TtKX+3bsElqBdMopFNq7UL21j6J5ivczWm0qKiam5ulSx672Eh/dgjKWu6kYFW8WwdL+0PYfCVODLcTtRB6/GnS6PAujuNJYnQFPnqoe9HlhJ3eoWnlLFjgojaLuNuvrS+oDcjNPzhyZOunDU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713376829; c=relaxed/simple; bh=Dq26QfCgnNaI2tOpF1lMZEHiWUNQ/2Uht7UQhqKYR3g=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=LpkyqQd1Onux95lRe1GftPh2/13Jn9zc/fnK+ktAEnYY0pLCzrmMeejIASuLrITpx/uFplBXOua3JCulOxINtyELDPjtpyJ+jdE9EiN/5fQrDMElK31/itPFpnKLALjx046j+rtCPMbXLvgwpr16bpYbwl2DRb00GmvFLtvYtf0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=g9K/RXMI; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713376826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=4CqEU9pkrruCGPgaK3aKCqLwJU0gMOcZXnjX2G2B4QE=; b=g9K/RXMI5gRd3LQx1R01T1v5WCWW2lcDf1Oi2go9gCCdNi6ZLPkf9xHCDSZ9MRpoznbe9D I0vjBk0AyDKQytyo5JRhpfU1CPvTMsglRkYbyeDOE1sdOhihfV1fXlLXoB5ZeYEizFSgdi EeTAPYiP+EUFjmqLq177vEGY8tQqNOk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-79-RXnpd9TUMWycQMsvV3WMKA-1; Wed, 17 Apr 2024 14:00:23 -0400 X-MC-Unique: RXnpd9TUMWycQMsvV3WMKA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9583618A8260; Wed, 17 Apr 2024 18:00:22 +0000 (UTC) Received: from file1-rdu.file-001.prod.rdu2.dc.redhat.com (unknown [10.11.5.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5522D4011FF7; Wed, 17 Apr 2024 18:00:22 +0000 (UTC) Received: by file1-rdu.file-001.prod.rdu2.dc.redhat.com (Postfix, from userid 12668) id 392F330C2BF7; Wed, 17 Apr 2024 18:00:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by file1-rdu.file-001.prod.rdu2.dc.redhat.com (Postfix) with ESMTP id 3583C3FA97; Wed, 17 Apr 2024 20:00:22 +0200 (CEST) Date: Wed, 17 Apr 2024 20:00:22 +0200 (CEST) From: Mikulas Patocka To: Peter Zijlstra cc: Mike Snitzer , Jens Axboe , Damien Le Moal , Ingo Molnar , Will Deacon , Waiman Long , Guangwu Zhang , dm-devel@lists.linux.dev, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] completion: move blk_wait_io to kernel/sched/completion.c In-Reply-To: <20240417175538.GP40213@noisy.programming.kicks-ass.net> Message-ID: <546473fd-ca4b-3c64-349d-cc739088b748@redhat.com> References: <31b118f3-bc8d-b18b-c4b9-e57d74a73f@redhat.com> <20240417175538.GP40213@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 On Wed, 17 Apr 2024, Peter Zijlstra wrote: > On Wed, Apr 17, 2024 at 07:49:17PM +0200, Mikulas Patocka wrote: > > Index: linux-2.6/kernel/sched/completion.c > > =================================================================== > > --- linux-2.6.orig/kernel/sched/completion.c 2024-04-17 19:41:14.000000000 +0200 > > +++ linux-2.6/kernel/sched/completion.c 2024-04-17 19:41:14.000000000 +0200 > > @@ -290,6 +290,26 @@ wait_for_completion_killable_timeout(str > > EXPORT_SYMBOL(wait_for_completion_killable_timeout); > > > > /** > > + * wait_for_completion_long_io - waits for completion of a task > > + * @x: holds the state of this particular completion > > + * > > + * This is like wait_for_completion_io, but it doesn't warn if the wait takes > > + * too long. > > + */ > > +void wait_for_completion_long_io(struct completion *x) > > +{ > > + /* Prevent hang_check timer from firing at us during very long I/O */ > > + unsigned long timeout = sysctl_hung_task_timeout_secs * HZ / 2; > > + > > + if (timeout) > > + while (!wait_for_completion_io_timeout(x, timeout)) > > + ; > > + else > > + wait_for_completion_io(x); > > +} > > +EXPORT_SYMBOL(wait_for_completion_long_io); > > Urgh, why is it a sane thing to circumvent the hang check timer? The block layer already does it - the bios can have arbitrary size, so waiting for them takes arbitrary time. Mikulas