From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.25 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796378344; b=zRG0cyeFM+YH8R8YRpShLSxEzxQ++n5jkx4rIsyxnInA7hxG9VBhz9pe3R/7GdRFpPBR bNPDVTU8c4M8GMgTekskycu4dIv4kP3xJK6LsYkECBt3b8g4aQVK6JqjZLEygqzKZHfsT afFf/DlUKC1uaKZFdVEgdQ3nnfWri6Edk2ipZGAPPxNxn7IF3WemufZtgfo5+nej2YX5x 2/ulicfjDoaevfyp5o8SSIwLdKj+1I3K++oXWV/T7TQgCExhvOYIcwrq0f9tgNpnDta5r 4aUsrshScAEDyoS928ZYZQWKLmVQEiMtB0ieXLzgeH2Q02kSyrUxFykmwfiWoWOmtWA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796378344; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Cc:Subject:To:References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=vU1F2L+ZJiCOU31W+h73pF5kH0rdiSny4K3nQ63nvFg=; b=ELfcjBT9GRIdM7Z+aHqVlg2PJYt3sldoIVcFd+zlpek49vB6JCh19GQ2x5TUpegrx+WH k+xTRbAupDZQTj3bq2NeVRkY5McIcVSDVexqVOQ3RdJEWFjLcdkxf0LmR/VNwBUE4Pfqy ajkyLvvqx3gRhxos2Vmg+y10jTLwwJXd7NDavWztBB5Kjs3OGMzbnomEWMA53uTYiuYPh MmFOP4VspRckAjkuyJq4VJJFwlr55pccuOg0P+xADpMT4IEMEffGUKH+bVY39uG2zhpGs QXJknyJye0bYYH+JeBVslNwsZkNE+JZ4hRn/2xxGFFryPUF+OxnGnMlRMOEeYQBcOCg== 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=RNb3s4Sw; arc=none smtp.remote-ip=91.218.175.25 Received: from mta0.migadu.com (out-25.mta0.migadu.com [91.218.175.25]) (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 9043B606A330 for ; Fri, 4 Dec 2026 09:59:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9043B606A330 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=RNb3s4Sw X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=o58ti6zM1wpkWtMXmTaSFhbCUyBamPMgOfzkdkyQwoo=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796378341; v=1; x=1796983141; b=RNb3s4Sw/cBsb85PGeeuiDsgDhToLq3aZTQE7XP/gTkQLD/nnII/5lzZ+UBjzYSXHmVfs33Z PHz9WtZmCAiJY6l3UfSQJyTDoZVVEuCujdkH44ZEyolPiXC8F/jHbvmZrMvwy5qNsHtOUF0uB68 UvqO9rzcboZXZJy8R7VVGP1s= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 60dcd47a47746558; Fri, 04 Dec 2026 09:59:01 +0000 X-Mizu-Trace-ID: 60dcd47a47746558 X-Migadu-Flow: FLOW_OUT Message-ID: Date: Fri, 4 Dec 2026 17:58:55 +0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: cui.tao@linux.dev, hch@lst.de, Tetsuo Handa , cuitao@kylinos.cn, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Shin'ichiro Kawasaki Subject: Re: [PATCH v10] loop: defer the queue limits clear to a workqueue To: Bart Van Assche , axboe@kernel.dk References: <20261126054223.176824-1-cui.tao@linux.dev> <20261203081657.2577866-1-cui.tao@linux.dev> From: Tao Cui In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hello, Bart, 在 2026/12/4 1:18, Bart Van Assche 写道: > > On 12/3/26 12:16 AM, Tao Cui wrote: >> +        lo->clear_wq = alloc_workqueue("loopc%d", >> +                        WQ_UNBOUND | WQ_MEM_RECLAIM, >> +                        0, lo->lo_number); > > WQ_MEM_RECLAIM creates a rescuer thread per loop device. Is that flag > really needed? Additionally, has it been considered to use a single > workqueue for all loop devices? Agreed on the flag: v11 drops it, loop%d, which runs the request path itself, does not use WQ_MEM_RECLAIM either. On a single workqueue for all devices: I'd rather not, if you're OK with that. The work function reads the loop_device, and the per-device queue is what keeps that safe, since lo_free_disk() destroys it before the loop_device is freed. A shared queue cannot be destroyed at teardown, so the work item would have to carry a new reference on the loop device. loop%d is per device already, so I'd keep this shape unless you prefer the shared queue. > >> +    if (!file) >> +        return false; > > lo_fallocate() has already dereferenced 'file', so this can't happen. > Agreed, will remove. >> +    if (!queue_work(lo->clear_wq, &w->clear_limits_work)) { > > queue_work() cannot fail for a work item that has just been > initialized. Please remove this error path. > Agreed, will remove. >> +        if (loop_clear_limits(lo, file, mode) && >> +            test_and_set_bit(0, &lo->clear_limits_reported)) >> +            rq->rq_flags |= RQF_QUIET; > > Please move the RQF_QUIET changes into a separate patch since these are > not needed to fix the race. Sure, I'll post it as 2/2 of a two-patch series. The marking is what keeps loop/011 at exactly one dmesg error per binding: without it, concurrent failures can all report before the first clear commits (this is how blktests CI failed loop/011 back on v6). > >> +    if (lo->clear_wq) >> +        destroy_workqueue(lo->clear_wq); >>      if (lo->workqueue) >>          destroy_workqueue(lo->workqueue); > > Work queued on lo->workqueue queues work on clear_wq, so please destroy > lo->workqueue first. > Agreed, will swap the order. Thanks, Tao. > Thanks, > > Bart.