Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3996675rdh; Tue, 28 Nov 2023 09:04:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IE51b08+LqOwlvAk9xtNFx3ypdwvFGewR33c42+Ud54BtXYhuooTrxqvcvAZM0EU/W4ZBmI X-Received: by 2002:a05:6a21:3988:b0:18a:df45:fad4 with SMTP id ad8-20020a056a21398800b0018adf45fad4mr18169551pzc.37.1701191052405; Tue, 28 Nov 2023 09:04:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701191052; cv=none; d=google.com; s=arc-20160816; b=tx3kqX/4z2cOgv1K7x6tSp2UCPeZB90NnTnqF+lWUY/pbEFdoh3EJIOJrZMTNbU5OQ VxkaxRMm3p7fhZhYWYRHodZU1XPPUTKNLhxHECAIBV8trOPpGzeZ6QLEJ6Y36D+BPJIO Euul2maC0fg4AU84afvzE9TQ6MIwoIlfiFFbyPREmQDgX7r+QrXahP11Y31vwe99tARP JFSQMrSdyvDkzRzjiS5AwLktOVpjgSnS1pj10/g2nXC2iNcLIAwrhNks1/Wp6ydqPN21 g93kM2Joi2Lz5KFXAAh4BpJ5VFZwsqA69lSFj/VzjXlpLiYFT30vmbYwOt5RtZPba8AQ eebw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=5xJUMRtpP0PPy0iDA3FSq+XNxMW0H+Y5iZLNztTj2pA=; fh=NgmM/LgFuVVs402r0XWmNkhLaO+SQ9eWQfwdU+YoZ/s=; b=x0xSe3EQSQYEWtgzeHe78pxAfVJmFPtEsCoa3+cb6HGp3xaKVSSVAoRPMzNt3DFuQP 7suPgip+0NjHYy5kFqI5UZUhJO0CoEcvi83nl3VuoXlMW2SeAkIYGvRPVuMdWy/q4kRP tIia3i1ktW4X3oONPHHGmM3bElMp7f+9Kg5JuF0nxI3fTON1eJFTrdGwXwFyGriUF2C7 /b5o1xp28mVOI7Dd7XoAWWtyQZS3Eezoq2c+UeauOKCjffqOnptLpMmzAVPZUJ8v29Sj Zcwv2wIpUovQj5vWEfnj1MAE0yCAWw5wGhNCaMgXqprmhqLKKvI2cdIbd9IfPP7oA8n4 af3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VAJxPhNq; spf=pass (google.com: domain of linux-nfs+bounces-133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-133-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d21-20020a656b95000000b005b9519d9e3esi13238860pgw.242.2023.11.28.09.04.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 09:04:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VAJxPhNq; spf=pass (google.com: domain of linux-nfs+bounces-133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-133-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 12FC52829C1 for ; Tue, 28 Nov 2023 17:04:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1BD314F8A2; Tue, 28 Nov 2023 17:04:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VAJxPhNq" X-Original-To: linux-nfs@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9938510DC for ; Tue, 28 Nov 2023 09:04:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701191047; 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=5xJUMRtpP0PPy0iDA3FSq+XNxMW0H+Y5iZLNztTj2pA=; b=VAJxPhNqJ3sgxueuiGvTUpZfhLuxQRv/FPmlTOo+0m968pGhtkRUFA2gw1iW3n3O4rc/Fw EcBlZhZCiqGbnEi1uNC+/WrITtTFx8LX0qZc7nTt1INhJ75IJThLlIN3NDFNHSZGaQOD1O eEcEmZfwv/FZz/qIK0ohwSY9Ag/wWEA= 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-250-Vroa0AwkOkCAwOb2IbE7AQ-1; Tue, 28 Nov 2023 12:03:54 -0500 X-MC-Unique: Vroa0AwkOkCAwOb2IbE7AQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 5483F916D62; Tue, 28 Nov 2023 17:00:54 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.14]) by smtp.corp.redhat.com (Postfix) with SMTP id 0F1D11C060AE; Tue, 28 Nov 2023 17:00:50 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 28 Nov 2023 17:59:49 +0100 (CET) Date: Tue, 28 Nov 2023 17:59:45 +0100 From: Oleg Nesterov To: Christian Brauner Cc: NeilBrown , Al Viro , Jens Axboe , Chuck Lever , Jeff Layton , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org Subject: Re: [PATCH/RFC] core/nfsd: allow kernel threads to use task_work. Message-ID: <20231128165945.GD22743@redhat.com> References: <170112272125.7109.6245462722883333440@noble.neil.brown.name> <20231128-arsch-halbieren-b2a95645de53@brauner> <20231128135258.GB22743@redhat.com> <20231128-elastisch-freuden-f9de91041218@brauner> Precedence: bulk X-Mailing-List: linux-nfs@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: <20231128-elastisch-freuden-f9de91041218@brauner> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 On 11/28, Christian Brauner wrote: > > Yeah, I had played with that as well. Only reason I didn't do it was to > avoid a PF_* flag. If that's preferable it might be worth to just add > PF_TASK_WORK and decouple this from PF_KTHREAD. OK, I won't insist. But, > + /* > + * By default only non-kernel threads can use task work. Kernel > + * threads that manage task work explicitly can add that flag in > + * their kthread callback. > + */ > + if (!args->kthread) > + p->flags |= PF_TASK_WORK; The comment and the name of the new flag look a bit misleading to me... kthreads can use task_work's. You can create a kthread which does task_work_run() from time to time and use task_work_add() on it, nothing wrong with that. Probably nobody does this right now (I didn't try to check), but please note irq_thread()->task_work_add(on_exit_work). Oleg.