Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1927186rdb; Wed, 31 Jan 2024 13:32:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IE0HkU2OGRPiBUprR5yxQyDOMYfdTFsNq8wcPw43iSpTDDShrfIbrbt4LNb0eCZ0wQwfHe/ X-Received: by 2002:a05:620a:394a:b0:783:f79f:440f with SMTP id qs10-20020a05620a394a00b00783f79f440fmr724169qkn.55.1706736770539; Wed, 31 Jan 2024 13:32:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706736770; cv=pass; d=google.com; s=arc-20160816; b=xDoNUOj4hyW3cdgiAAhbb1HkD4KHLDr/BXe8n/Ara6n0qdeehvU3UD8HrUovEAch6c Dp3RiUBeemU9s68hfhJJFJesxzVLmHarHoqH8+Cm8HE+GKW4HAeuxMNASVtVq/2DnESh iM+QeZgTe7HrFuFjfJIYyaRjmb33u9e5FNq1aRv8uac2QbRNV4oXPaD9kvesoRzOslny f1hltWJPbx2t0h8cIoPYv+Kanos5+Hc34AkOZeh8SS4NOchgHfS8pcvV3iewW/b/XLQc 3oCRstE7g5QoO+oEXRRoO/cpWKoFNonootzLglGU0cjhEbOiAgW9pgPoOkN2Hm23qA5b PiiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=WFmzHu5ktzDR5khDgjr495NTAW/wkz8lMozFpGfYzLY=; fh=ftiNFLS5hUu5xCVF0qisZ9HkFNTAT6HTxGmTIy84yXA=; b=Jl14taB/W0BTeIwLrdI7eZDC8K/ULxSkJADczGeInKEKHikHr3kmDz/i22TWN3WIE9 OL2/37bpGj+61ButkrOLSni7zAkuoUSQGWmwuCY6sCYXPzdhkb4SNcdMagcFvrcvs9jG IkEgNhpTAL9ulJLFYfcw8PGbEDg2By+HmqHMYINeVa5ChFkER78FFP0+WuC26IB7c1rg 9V4HpYYsyDlzmHBXwDmR4oGektaYwHptliWjra5CB95h6d17Q5PToSdrYWxFXB1UtipV 4ljUq+uQsnIvmsrIisUdmVHipMJkNwqXls9+d9+7X0DZZHN29BvYXV8l5anpibJdkQOG 43Bg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nEei4V0b; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-47173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47173-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCX3pc+Z34rKpJas1wLpT3eOc0AHdCMupRXD9nheF3Ab3Gftd5TuE2VZGZJa2wRaKmTB3xRjDqbC2GY/yfMfvoWBqUTR2fUQJk7F4bxQIA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o16-20020a05620a22d000b0078316dbc426si9097233qki.551.2024.01.31.13.32.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 13:32:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nEei4V0b; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-47173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47173-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 46D9F1C251F5 for ; Wed, 31 Jan 2024 21:32:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3B1639AD0; Wed, 31 Jan 2024 21:32:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nEei4V0b" Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7728C39854; Wed, 31 Jan 2024 21:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706736755; cv=none; b=RdPOyyI9pMgJRgQzF19wU7JyWEOwI7woSo+KiGuIa+oF34Vki1iCkmfvFDJM9aTax4IPlNYPEZ8O/kAdSqTZdbHZAydh0EIhQgc/1YM8/Um/38rQE2OoIOQePm2s2Z8ZEvLlH608UlZcVkyxwLYqs6xwGMlXbDuasu717HJHcq8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706736755; c=relaxed/simple; bh=OPLlnkShPkDfpkes/8TXUTg03uQrES6q+f1wxtN714Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=o2fjq0f8zAREfMYV9HWV3xy9tET8EbBp+Y+KSFx7R/wZCojVxm71DcTgOKN9ntfXRd//ux61T/1VZ965+Okq7c3QdIfXvMSGufJsQ3dVNfXJunLjMb9gcGvWBb8tdBpOxtGDoi9eccVZbr7FfPlM+Ge4O0k41Ve1mApzSSIdo1U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nEei4V0b; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-5d42e7ab8a9so225302a12.3; Wed, 31 Jan 2024 13:32:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706736754; x=1707341554; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=WFmzHu5ktzDR5khDgjr495NTAW/wkz8lMozFpGfYzLY=; b=nEei4V0bLB8Ul/1dSNb+9j0RD2O9AR2iP8f3Rb5zS65qCgZype+fuoNCciVFbMFcGX HGFno9VN4U2I77LrjmFiFPAxOwxti6Z2ieSiAKZqLN3TpdpPxaK8Gx8jKYqU4n0dxTqd t7cM+MlIROgMxLQtY9jpRycTMGVRMh1Ka1wSXQKC4x/HjeiwNXehqBvcGBWW0iLbNpad qVmcjbCw2VC7zJ1+/n/4atxsZgGqKsC7uVEV01haA5f4LNQ7Mn/a6SSwY/JJpD2nDVtO ptSAwTtDZY23Cqtir/XpQSNMEFgDF68CZZDPlvil2N7/Ox2ZntbHkZR26+w4ULlECRzy AJ9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706736754; x=1707341554; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WFmzHu5ktzDR5khDgjr495NTAW/wkz8lMozFpGfYzLY=; b=KVTv8PYX4Capt80SwKzluxSrXrDIKmlj/zeeIlfBjLP3L9CE0KaLFKHItWkJrH7Ds2 qrIZI0V1WGhDw94kRxz3O5hKgJm3434K1Yrq+MUmkwQOC2bLBjUraC9NgQ9Uax2aS35R eVyJoeOsLXoHk1BXgQ8WbVVyrhAyKEAcOa9I1RsdY1oHa2BGyuR/iNPmBAjVVzuIiIJM 8CfUt+gD2JIQ6EmpBTT4vcE20n9bH6FJWabwN86wByFMlKNqkdkG0WCTz+iwjj14P/4x 6ThXt88/snseWR805UYwC8FNhGfG5aDDmOg08+Ba9dqvWC646tMMRILOHFlE+BX6e2DT GT5Q== X-Gm-Message-State: AOJu0Yy9psJ5rOPh6Hk5U9yX50bzGWOfqIb7Q//PaEmubXwtmhDUiARP Siq9ViALXZeEUctuDPuvFOXeSxzVISg+dHZDdPd4DoF6lCdd9uV1 X-Received: by 2002:a05:6a20:3b94:b0:19c:7c49:4cf with SMTP id b20-20020a056a203b9400b0019c7c4904cfmr2582707pzh.43.1706736753446; Wed, 31 Jan 2024 13:32:33 -0800 (PST) Received: from localhost (dhcp-141-239-144-21.hawaiiantel.net. [141.239.144.21]) by smtp.gmail.com with ESMTPSA id u4-20020a170902e20400b001d93bb0c9c8sm966974plb.85.2024.01.31.13.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 13:32:33 -0800 (PST) Sender: Tejun Heo Date: Wed, 31 Jan 2024 11:32:32 -1000 From: Tejun Heo To: Mikulas Patocka Cc: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, dm-devel@lists.linux.dev, msnitzer@redhat.com, ignat@cloudflare.com, damien.lemoal@wdc.com, bob.liu@oracle.com, houtao1@huawei.com, peterz@infradead.org, mingo@kernel.org, netdev@vger.kernel.org, allen.lkml@gmail.com, kernel-team@meta.com, Alasdair Kergon , Mike Snitzer Subject: Re: [PATCH 8/8] dm-verity: Convert from tasklet to BH workqueue Message-ID: References: <20240130091300.2968534-1-tj@kernel.org> <20240130091300.2968534-9-tj@kernel.org> 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 Content-Disposition: inline In-Reply-To: Hello, On Wed, Jan 31, 2024 at 10:19:07PM +0100, Mikulas Patocka wrote: > > @@ -83,7 +83,7 @@ struct dm_verity_io { > > struct bvec_iter iter; > > > > struct work_struct work; > > - struct tasklet_struct tasklet; > > + struct work_struct bh_work; > > > > /* > > * Three variably-size fields follow this struct: > > Do we really need two separate work_structs here? They are never submitted > concurrently, so I think that one would be enough. Or, am I missing > something? I don't know, so just did the dumb thing. If the caller always guarantees that the work items are never queued at the same time, reusing is fine. However, the followings might be useful to keep on mind: - work_struct is pretty small - 4 pointers. - INIT_WORK() on a queued work item isn't gonna be pretty. - Flushing and no-concurrent-execution guarantee are broken on INIT_WORK(). e.g. If you queue_work(), INIT_WORK(), flush_work(), the flush isn't actually going to wait for the work item to finish. Also, if you do queue_work(), INIT_WORK(), queue_work(), the two queued work item instances may end up running concurrently. Muxing a single work item carries more risks of subtle bugs, but in some cases, the way it's used is clear (e.g. sequential chaining) and that's fine. Thanks. -- tejun