From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6142EB64DE for ; Tue, 10 Sep 2024 14:21:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6DE1B8D007E; Tue, 10 Sep 2024 10:21:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 68DEE8D0002; Tue, 10 Sep 2024 10:21:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 556908D007E; Tue, 10 Sep 2024 10:21:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 37A688D0002 for ; Tue, 10 Sep 2024 10:21:03 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D3E361A0539 for ; Tue, 10 Sep 2024 14:21:02 +0000 (UTC) X-FDA: 82549040364.28.3D53A3C Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf29.hostedemail.com (Postfix) with ESMTP id 4884B12001D for ; Tue, 10 Sep 2024 14:21:01 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=yXWuVvzp; spf=none (imf29.hostedemail.com: domain of BATV+33ed81108a7d293f2f12+7688+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+33ed81108a7d293f2f12+7688+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725978033; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=SQ27hHAn9LKNNpp23rFT1O9ivXHn5Hr9ICtgjyHmaxI=; b=H3aevnQb/gBVB3OGeljeIra6abV2gy7WtPNvRKTkrKnJtVMPUrOc/pJjDvKzxyPlUA2rCG O5NRhEB/WBNqRTBi7thdGzn/RYXN9Sry3CVDfNCi6TJAnmUoCTcUUx06VAwFJWnO/Ybwmm e7ctZOygawF2HlzwGzn2W3dv4LMjzzQ= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=yXWuVvzp; spf=none (imf29.hostedemail.com: domain of BATV+33ed81108a7d293f2f12+7688+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+33ed81108a7d293f2f12+7688+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725978033; a=rsa-sha256; cv=none; b=MCX232xvXl57YEHPljqU5Z48UewvXA203u8V7PIR00L/mKFvxNxCyhg26z5rndfIEutflx UGNjJu5hXDfAdGbfU52hTx0IQ8N4dFN2GMhmYhsrdLC6/8fkK9BnUUdaVFBzA3OyKEUaJw QHZ3YJCEVNtrJn0y91ScM0SP7W6pxtk= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=SQ27hHAn9LKNNpp23rFT1O9ivXHn5Hr9ICtgjyHmaxI=; b=yXWuVvzp4E5G7rZtyhPonNsJzN teBE57AVqWoRuO/UsYMqNbQ+xfVl8lDgaH8zz5d5K/a8QAxHM+dTgszMHdYXF/H8h/ILvZ7FrmqoQ bk/kUyp7hcooZ+H0XSeR0dQas8xSBYEY25TZ8jzlMLAJYxb8W2DgpjDiGIfQzMQuYa8kVrpBUTfJJ eO3ISs5OJjCPQi0603wr21fzqsmQkUC+y1f6NDc6RlsooTTsCEBjkl/JVsDQtQvJCq1Y0VVF/e+DQ 83J0/4zgG6LKGem72HO3TW8oQbw8u9AqnT9lK4c1SWvvDMo32UHvHYwhxs3Fyk3bvqVQn0ACVpaDl 2a88HINg==; Received: from hch by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1so1jn-00000005r8k-2FDr; Tue, 10 Sep 2024 14:20:59 +0000 Date: Tue, 10 Sep 2024 07:20:59 -0700 From: Christoph Hellwig To: Pavel Begunkov Cc: Christoph Hellwig , io-uring@vger.kernel.org, Jens Axboe , Conrad Meyer , linux-block@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v4 8/8] block: implement async write zero pages command Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Stat-Signature: ux5ok3ph6jb8q658zxip94uy9dqg5auz X-Rspamd-Queue-Id: 4884B12001D X-Rspamd-Server: rspam11 X-HE-Tag: 1725978061-910145 X-HE-Meta: U2FsdGVkX18D1uY/pojUflzOUfs9Ifuk7YCqhhNJIteRRSelKNneoDK2DG4Gsqkuv8/0yb3iAo3XHLxkBHOx5rywdD4uNhEltqlvDXgFPG1XRCiZo3CHSj/dKMhUcAhs2/pX+UxXWRvOjjl8QccuTTXSGoz9SKccjz+jRZcFE/wGS+tlsE0EQOgD0XzVEQDCMU25bzUkqUVVBHAmNkk6tkI2laExcLPBII3rS82dGXoNag1aWtujiO3VXSvaS6Re8Az+UI3kF7FUvXpWJW92beDPzTvr3KJFYL8MR/eY24dThi4+deFpU6v1RaEG9SDtRL3BvfX+ZxNy5W0KEaYU0B2v9/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cUbMUPivb28XLKtGMWEG03GgXCZvJItjLt/54K5tAVbHK60c3DA6fdODAazQCMLm1Chg8dBov7Oeaht+0fXo7W0TpAknfEVnZtjhNZOtyhlMTO19ukQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Sep 10, 2024 at 01:17:48PM +0100, Pavel Begunkov wrote: > > > Add a command that writes the zero page to the drive. Apart from passing > > > the zero page instead of actual data it uses the normal write path and > > > doesn't do any further acceleration, nor it requires any special > > > hardware support. The indended use is to have a fallback when > > > BLOCK_URING_CMD_WRITE_ZEROES is not supported. > > > > That's just a horrible API. The user should not have to care if the > > kernel is using different kinds of implementations. > > It's rather not a good api when instead of issuing a presumably low > overhead fast command the user expects sending a good bunch of actual > writes with different performance characteristics. The normal use case (at least the ones I've been involved with) are simply zero these blocks or the entire device, and please do it as good as you can. Needing asynchronous error handling in userspace for that is extremely counter productive. > In my experience, > such fallbacks cause more pain when a more explicit approach is > possible. And let me note that it's already exposed via fallocate, even > though in a bit different way. Do you mean the FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE case in blkdev_fallocate? As far as I can tell this is actually a really bad example, as even a hardware offloaded write zeroes can and often does write physical zeroes to the media, and does so from a firmware path that is often slower than the kernel loop. But you have an actual use case where you want to send a write zeroes command but never a loop of writes, it would be good to document that and add a flag for it. And if we don't have that case it would still be good to have a reserved flags field to add it later if needed. Btw, do you have API documentation (e.g. in the form of a man page) for these new calls somewhere?