From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.251 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796095684; b=sVzAE9PeO2jhk1Mtm/jUOYyy6xAY0gnvw887/Vuuk+JhNbtoWxMJK/L2JWmObQS3ox1d CEs5Wm9wwU6Av3+zc4s1ZnMjosqh2mW8b0A5dqjybr2lBmJRw9/YomziycSqt+MwUObwW 9Oef12ldzKqcCHKgK3CIvB3nhCYQhbtuHJPfW6b54xpLAxSHAt91yviMCvu/rYjopTBzS Y9ca2n61DG4d5CYompkUQcSQioNWbi2Z13xfnwN1E7Uz8+vFyVPy1XK7BaA1/pNVkEPdr BX8cZf9sRSQsj0yqkED6m8G2z5dzrpdTG2I+aDrLjcC7lCgNcQ0kUeEjcdBWl+nphTQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796095684; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID: X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=jwZEjDciy6z9T/McmO9CO01wxP0YtCEtp5Uo15DnYjE=; b=Cb44rFGIGBwCn8J84xok6hoLY4qc3Mk3EkN53eNAozzVkA/RH7l8DyDEVW/8RqF5yp3F /pEl5lx0xtwdS9m9LraXmpKhAVsZl6d8VoJWzbpf0aTB5AhmxuOcTQS5Z4SczcRFJP04d op184DA6oVqLOeig8cseaC2nHSBjTFH9o849YTXeg4NbFveliN5ofwUpCBCW1OqO4C7KQ nv21LjN+7Hnt5wuaO4l/zPkyMvtrBA0U3N58HUQC1Psb9r2Kbci+20PyoEspEFholOhqx FdzJ83unTm5nJWZ5uJM5rtikCxSKWGdsLCnihkVTJhWEMQBILm0RluGN1KmoJHvqAjA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=avVCTsmV; arc=none smtp.remote-ip=95.215.58.251 Received: from mta1.migadu.com (out-251.mta1.migadu.com [95.215.58.251]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A5AE606A325 for ; Tue, 1 Dec 2026 03:28:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4A5AE606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=avVCTsmV X-Envelope-To: linux-cifs@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=VRQVOzdrPvOD4ez7v9an6ecCt3WVegC6fbko/w0xiic=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796095681; v=1; x=1796700481; b=avVCTsmVgDbGaTIkRU8CPi85WXI4XIyJxDR2DmtXBkQDlr9kKjAd8Ya3A80MY7o9aoELmn8t gMN++3FjGfBJzpdWCBsPRWER2kA7Ak/wTBKCVMOnAr75NHhAtnLhYeAQU0DRzPjNCOsbTwa3X5z Cr48QSy1g5BiTaKbh8cOqC5s= X-Envelope-To: linux-cifs@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id db54c57d0486490c; Tue, 01 Dec 2026 03:28:01 +0000 X-Mizu-Trace-ID: db54c57d0486490c X-Migadu-Flow: FLOW_OUT From: Huiwen He To: linkinjeon@kernel.org Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, senozhatsky@chromium.org, tom@talpey.com, chenxiaosong@chenxiaosong.com, tj@kernel.org, jiangshanlai@gmail.com, stefan.chulski@broadcom.com Subject: [PATCH 0/4] ksmbd: allow request dispatch on an unbound workqueue Date: Tue, 1 Dec 2026 11:27:44 +0800 Message-ID: <20261201032749.2224354-1-huiwen.he@linux.dev> X-Mailer: git-send-email 2.43.0 X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Huiwen He ksmbd currently dispatches incoming requests to a per-CPU workqueue. Pipelined writes on a single connection can leave the receive thread and workers competing for the same CPU. An unbound workqueue lets workers use other CPUs, but the cost of cross-CPU handoffs can outweigh the gain from parallelism. Patch 1 fixes a race that can let ksmbd accept a new startup request before reset finishes restoring the server defaults. Patch 2 handles startup failures in the current control work item, so recovery does not depend on allocating another one. Patch 3 exports the helpers needed to set CPU scope before sysfs registration. Patch 4 lets ksmbd.mountd select the workqueue for all incoming SMB requests at server startup. With the companion ksmbd-tools patch, administrators can set "server request workqueue = unbound" in ksmbd.conf. The default is "percpu". Single-channel fio throughput in MiB/s on tmpfs (schedutil, 128 CPUs, 16 jobs, iodepth 32, mixed 50/50 read/write). Both unbound scopes are non-strict (shard = cache_shard); delta compares unbound (cpu) with per-CPU. Size I/O per-CPU unbound unbound delta (shard) (cpu) ------------------------------------------------------------ 4 KiB READ 294 182 243 -17.3% 4 KiB WRITE 251 178 177 -29.5% 4 KiB MIXED 263 146 199 -24.3% 64 KiB READ 2583 1791 2171 -15.9% 64 KiB WRITE 1640 1882 2013 +22.8% 64 KiB MIXED 2194 1503 1834 -16.4% 256 KiB READ 3119 3012 3127 +0.2% 256 KiB WRITE 2183 3155 3233 +48.1% 256 KiB MIXED 2906 3213 3239 +11.4% 1 MiB READ 3398 3259 3413 +0.5% 1 MiB WRITE 2047 3032 3091 +51.0% 1 MiB MIXED 2859 3367 3416 +19.5% The October RFC explored using an unbound workqueue for selected WRITE requests [1]. As a follow-up, I am looking into an adaptive mode that weighs the benefits of parallelism against the costs of spreading work across CPUs. The goal is to outperform both fixed modes on most workloads and become the default. [1] https://lore.kernel.org/r/20261022092514.2590010-1-huiwen.he@linux.dev Huiwen He (4): ksmbd: keep server in RESETTING until defaults are restored ksmbd: reset the server directly on startup failure workqueue: export attribute and sysfs setup helpers ksmbd: add request workqueue mode startup option fs/smb/server/ksmbd_netlink.h | 8 ++++- fs/smb/server/ksmbd_work.c | 64 +++++++++++++++++++++++++++++++++-- fs/smb/server/ksmbd_work.h | 3 +- fs/smb/server/server.c | 27 +++++++++------ fs/smb/server/server.h | 4 ++- fs/smb/server/transport_ipc.c | 5 +++ kernel/workqueue.c | 4 +++ 7 files changed, 100 insertions(+), 15 deletions(-) base-commit: 87ff512becd45a08c44fd47a9f03e607af9ef6bd