Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp98014rdb; Mon, 4 Dec 2023 22:41:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3kmCE1KjLcN/n3/Pbb9n+6JtTKGl3AUok//hhh0Xvtxzhy+AL2/S3myVb9ryGVE5LSE4E X-Received: by 2002:ad4:5892:0:b0:67a:a721:9ead with SMTP id dz18-20020ad45892000000b0067aa7219eadmr723525qvb.94.1701758515819; Mon, 04 Dec 2023 22:41:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701758515; cv=none; d=google.com; s=arc-20160816; b=j4pFJX3UoTm9/ZxbUdbfkxY3y/kkTyJEI8YhcS7/iSqqxjBZobJVBZfsQ4pYmJu9x8 8E/V8iD5iggNn5j3XzgLD5279i4A/u2luSRsmZy47bAIOnI2ElAGnEdudF3pbPaPkngD zXbxOfg4QnazlKOd9dYFTyfTpQSimqv4qsHN4iUWPjTMf65trbB8IpCJfwGYgVGmnTLf KJeDmRrAh6dEH9htNjiH8GyG3pZU0N3c/zS6FjYW1dXDgZj6n/7e+Zx759mWKXWszDBC ssdKcvurziVpqVpxBEwCmUG3qrOb0lyATRAoYL2gShxJ8+xz75CNUA9tYt8ABslcDTlq xH8g== ARC-Message-Signature: i=1; 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:dkim-signature; bh=sM9HKgTZr+p8ADu3gd1UavO919XUEWryeTGCYLI3vNw=; fh=+qd/FlBCtbnf4KHfSWBBrhG/QkDaUMKVTBYeffSRxpo=; b=jSUNSXxa4B279rIyF8Q/bXOBSJI3hpwzO3oPr3LujSM+rGPeCTyzLE8uQWcgpoe45O 1FRzlzWXYW8CIC9SY975InunnqWh4TGMJQW4O0ry2oWPAFfm2NgkVDwWXww0Zqw0JATc o0c9J8SjU8gyaxbQLztcOd71F2onLPvhGfdU6wuV9A7KcpyIH1VTcMoC1gsko1C2hlQk wT7vakKZkEeOwgeqGZnGaXgKOR+Fh/rIDEG5BIvtCAfp40jx4B3oZLYuh8jNnJm7o3ur ilVd+5N3vkM4dpxsOKo2QTZbYATFWLxwym8WdEivhVVRrnjJoOQIwgY9e5pLjU6qQPA0 s38Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=E7clarBX; spf=pass (google.com: domain of linux-nfs+bounces-327-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-327-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j16-20020a05620a411000b0077d6b5057b4si11521244qko.734.2023.12.04.22.41.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 22:41:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-327-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=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=E7clarBX; spf=pass (google.com: domain of linux-nfs+bounces-327-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-327-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7A4761C20B5F for ; Tue, 5 Dec 2023 06:41:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B8DD12E53; Tue, 5 Dec 2023 06:41:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fromorbit-com.20230601.gappssmtp.com header.i=@fromorbit-com.20230601.gappssmtp.com header.b="E7clarBX" X-Original-To: linux-nfs@vger.kernel.org Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16FD3124 for ; Mon, 4 Dec 2023 22:41:50 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1d053c45897so35124035ad.2 for ; Mon, 04 Dec 2023 22:41:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1701758509; x=1702363309; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=sM9HKgTZr+p8ADu3gd1UavO919XUEWryeTGCYLI3vNw=; b=E7clarBXDAH9Z4294grZqgJPl/K4072peksEITs3kpEI4LYnGf3bKt7QME2Qi5Grge XIXCbBmy/iJbMwoWst/bBMqqNCD6QVZA18yRI6H1Bl+xqr6eIq5j6ZGH4vuKaBAkZnzT sUO96Bt+DaNW/lXNocLsPfc1ISh3I1N1rKcG9HGCEcRlguIlS0hBjqFsQu0dChdxEQYE RkRuPgTbo19HJAPnxh9jyleVkiKZjc0JpSRW6jqyA6WEEDT5Y1TsUXjB4vu5g81vvgoa 4NYvEdd0L9iia1R9aJTEOOWCjNGtLXFLvVkAJB6mWnXxKw9AE+qGJk7g4SDIyVy435Oy zBTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701758509; x=1702363309; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sM9HKgTZr+p8ADu3gd1UavO919XUEWryeTGCYLI3vNw=; b=HEYmf86k5rZSRlPCj6zPnKxexnHlIU9gsH2bkFYS4a+5CRblOV2zyMpgOSHkVQkyuQ HQpUEbuGWN+YTy0uiFgdFnz3+TEAqVBxRa1EGk2nwsPISAouMWetE6ucU/xH0mmWluO7 MXBKEUUa0rUMiLLxdfgaIG6JCYOCVqUJDmBIuZhInapVg2pwk8oRrUiQ7VNoGYMntk0U RmNp42TbW6kXcNwaIxkYEPAMfPezSdHhf32NXKaFBZurncIqRAcpftdFxsn/465x+553 IkI1lgA4+DjCCRa0zCC6tNdrHTSdMWNP/xGnPthPH8cmLhhijMLX4MjPLezBqB43je5j JuMg== X-Gm-Message-State: AOJu0YygZmW5+IkLhpW1LIdLAAZacOhLMwGpICXmpPNGSDUr7DZCUZqA 68UFaIqKRhKwOaO2s4XC6vA8Mw== X-Received: by 2002:a17:902:d2c7:b0:1d0:c445:8014 with SMTP id n7-20020a170902d2c700b001d0c4458014mr846274plc.76.1701758509530; Mon, 04 Dec 2023 22:41:49 -0800 (PST) Received: from dread.disaster.area (pa49-180-125-5.pa.nsw.optusnet.com.au. [49.180.125.5]) by smtp.gmail.com with ESMTPSA id h17-20020a170902f55100b001cfc50e5afesm7062435plf.23.2023.12.04.22.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 22:41:49 -0800 (PST) Received: from dave by dread.disaster.area with local (Exim 4.96) (envelope-from ) id 1rAP7q-0044Nr-2j; Tue, 05 Dec 2023 17:41:46 +1100 Date: Tue, 5 Dec 2023 17:41:46 +1100 From: Dave Chinner To: NeilBrown Cc: Al Viro , Christian Brauner , Jens Axboe , Oleg Nesterov , 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 1/2] Allow a kthread to declare that it calls task_work_run() Message-ID: References: <20231204014042.6754-1-neilb@suse.de> <20231204014042.6754-2-neilb@suse.de> 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: <20231204014042.6754-2-neilb@suse.de> On Mon, Dec 04, 2023 at 12:36:41PM +1100, NeilBrown wrote: > User-space processes always call task_work_run() as needed when > returning from a system call. Kernel-threads generally do not. > Because of this some work that is best run in the task_works context > (guaranteed that no locks are held) cannot be queued to task_works from > kernel threads and so are queued to a (single) work_time to be managed > on a work queue. > > This means that any cost for doing the work is not imposed on the kernel > thread, and importantly excessive amounts of work cannot apply > back-pressure to reduce the amount of new work queued. > > I have evidence from a customer site when nfsd (which runs as kernel > threads) is being asked to modify many millions of files which causes > sufficient memory pressure that some cache (in XFS I think) gets cleaned > earlier than would be ideal. When __dput (from the workqueue) calls > __dentry_kill, xfs_fs_destroy_inode() needs to synchronously read back > previously cached info from storage. We fixed that specific XFS problem in 5.9. https://lore.kernel.org/linux-xfs/20200622081605.1818434-1-david@fromorbit.com/ Can you reproduce these issues on a current TOT kernel? If not, there's no bugs to fix in the upstream kernel. If you can, then we've got more XFS issues to work through and fix. Fundamentally, though, we should not be papering over an XFS issue by changing how core task_work infrastructure is used. So let's deal with the XFS issue first.... -Dave. -- Dave Chinner david@fromorbit.com