Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1092501pxb; Thu, 9 Sep 2021 20:29:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQcu0mfOsvDdmrykdCDSqIr16YyZOXWdS64umY5SlFVKc7tdNbJ0ogBrt0fswEs3raQMVu X-Received: by 2002:a17:907:76b0:: with SMTP id jw16mr7030402ejc.193.1631244591967; Thu, 09 Sep 2021 20:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631244591; cv=none; d=google.com; s=arc-20160816; b=nKsuV8mrP+ge0tgD9e1pWEq/loePM8cA1N2EjBUla4AkvxmIW+rjQkViEKUhid3EnD yRWB2kgZPYLN2JbdngpFP6heU9cR1B9Zuvq+ZMPKrI/KyBDGDwE6Z0+q0oIU/eCD4QAu YUNJQsDjgYMO2ebuM4ztLxb1Fl3e79MjTIf5x0QkclRBk84lGCYEumkTJVw92mrYDpoQ dt9TCrCTwtk+nH2k1756ZXugFawmE6zsGAXDseKfnJCGClBvatoMysQzi0CGt/N2w4pM UxGqV4FqujRAeE9a/70EbScrrWWcjU78bts+BhWJmpjkVYRtCGUTMlT6YS/Pj3rmZukw uchA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=9q09vmNEad8UpKZ0WyfPH5RcyQkxw1WwzASPN9mwbnU=; b=wVZLEpw8fEFgXVs0daRoywG4HoUqM/HsLknYhGMv0Wcnu/XjgKouBbkKoNglVNNaBu kDo3C028LwNbyls+JFT9nlTLmcrdh2r5IzwLnepklmXF2YsazlgLEuPi0ziGMHyc1RAe JusLxtT7RnjU8mp5q7gWPQAU4TAqlzns/2MF+pCdxwVfSaP6YY4oLlj1up9zXLE1mDqE JwUVjYnQwCvQ2m4yg7KF3r77btEi/cEXcsGQiej7BaKL9GSs57OyOz5QZeiKEttXOYNY a6JNtvjITzkU8E6kv3hLxi9WqF+Ji/54UcN1RkA9LkzZjqA5ub5kHE+sm55LyaxM81tT utKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i1si5058276ejy.380.2021.09.09.20.29.27; Thu, 09 Sep 2021 20:29:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230036AbhIJD3G (ORCPT + 99 others); Thu, 9 Sep 2021 23:29:06 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:59322 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbhIJD3G (ORCPT ); Thu, 9 Sep 2021 23:29:06 -0400 Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mOXCk-002n9d-In; Fri, 10 Sep 2021 03:27:54 +0000 Date: Fri, 10 Sep 2021 03:27:54 +0000 From: Al Viro To: Jens Axboe Cc: Linus Torvalds , Pavel Begunkov , Linux Kernel Mailing List , linux-fsdevel Subject: Re: [git pull] iov_iter fixes Message-ID: References: <5971af96-78b7-8304-3e25-00dc2da3c538@kernel.dk> <9ae5f07f-f4c5-69eb-bcb1-8bcbc15cbd09@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9ae5f07f-f4c5-69eb-bcb1-8bcbc15cbd09@kernel.dk> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 09, 2021 at 09:22:30PM -0600, Jens Axboe wrote: > On 9/9/21 9:11 PM, Al Viro wrote: > > On Thu, Sep 09, 2021 at 09:05:13PM -0600, Jens Axboe wrote: > >> On 9/9/21 8:57 PM, Al Viro wrote: > >>> On Thu, Sep 09, 2021 at 03:19:56PM -0600, Jens Axboe wrote: > >>> > >>>> Not sure how we'd do that, outside of stupid tricks like copy the > >>>> iov_iter before we pass it down. But that's obviously not going to be > >>>> very efficient. Hence we're left with having some way to reset/reexpand, > >>>> even in the presence of someone having done truncate on it. > >>> > >>> "Obviously" why, exactly? It's not that large a structure; it's not > >>> the optimal variant, but I'd like to see profiling data before assuming > >>> that it'll cause noticable slowdowns. > >> > >> It's 48 bytes, and we have to do it upfront. That means we'd be doing it > >> for _all_ requests, not just when we need to retry. As an example, current > >> benchmarks are at ~4M read requests per core. That'd add ~200MB/sec of > >> memory traffic just doing this copy. > > > > Umm... How much of that will be handled by cache? > > Depends? And what if the iovec itself has been modified in the middle? > We'd need to copy that whole thing too. It's just not workable as a > solution. Huh? Why the hell would we need to copy iovecs themselves? They are never modified by ->read_iter()/->write_iter(). That's the whole fucking point of iov_iter - the iovec itself is made constant, with all movable parts taken to iov_iter. Again, we should never, ever modify the iovec (or bvec, etc.) array in ->read_iter()/->write_iter()/->sendmsg()/etc. instances. If you see such behaviour anywhere, report it immediately. Any such is a blatant bug.