Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1524077pxb; Fri, 10 Sep 2021 07:48:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycwbq95whmEQ2EW8xGsSWnpGXAyDBxjOK0rfOZeLSW87vjp1HEc2Vw0zlkj9FJa7JekZFP X-Received: by 2002:a05:6602:2436:: with SMTP id g22mr7468797iob.109.1631285329958; Fri, 10 Sep 2021 07:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631285329; cv=none; d=google.com; s=arc-20160816; b=EnkVloMS0o0Uf+ffsVPtV/S1ij8Kvuz+SzzFxYfEbKeBM15Kl0gS1wxIguFpjDmZil Q1BOvuXtMpWc1ktBt+W2tP1KNZbOO1ZjDHTweoYOI9Yv9DLwq4TOFAa4axAtHEw2WYND a05w57yjvnHFZfk2115CKckkmIjOjhzxRStRBkz0PS4t9nhfsJpur6tp/KT1SIxje8MG Y4arxICtfjMeUcxjf7cV+SeB+E21dGPkF+2qD/i8+A0jyxpn8fblpS3/hfoW+LRC/JUO /+SYwAzQVqFjId8Z09MVEL0gHGQdERZelbOpp0QKYR2NW3HnWRfuCSpelpuxVu0JFU8t LGcA== 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=jNfiPISux+6/GpvqqFqNY0CN9pMoYA6rDDRilQpWl5s=; b=VVkKljqQdNlQx08k4g5pga452jzEhzkqjrX2cK/YXiiB0clrcX5I2l7if1cmctdyaq WjxDq1YhNBcSfzT3+0TgmfoYvPBGaTgj163vGWTX+i+iT3ZXr0QwGXytqTV2+x1wsFwN GEv6H4YM3DMOhNOT8QCM8zj2uLN/4pXUOILu2JbyJMMg6sBTzkxJTmYR4G0ZAqLhabIE LYqDx2UjT0sJLOQND+D5WLoLJgKfZr0c5mIIzdWInHaCwaqCiUzrrIlLzIzKi6AIqZgf UimxEErNE9B1+v7Zx+rmb8uA31ipMQG2d8ps/MvXn9NeKXQKPrMNQMb0dnS3AtBIAwLi OWXg== 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 f24si5062403jaa.118.2021.09.10.07.48.37; Fri, 10 Sep 2021 07:48:49 -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 S233943AbhIJOsF (ORCPT + 99 others); Fri, 10 Sep 2021 10:48:05 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:39848 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229749AbhIJOsE (ORCPT ); Fri, 10 Sep 2021 10:48:04 -0400 Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mOhjZ-002vI7-Qg; Fri, 10 Sep 2021 14:42:29 +0000 Date: Fri, 10 Sep 2021 14:42:29 +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> <9855f69b-e67e-f7d9-88b8-8941666ab02f@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9855f69b-e67e-f7d9-88b8-8941666ab02f@kernel.dk> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 10, 2021 at 07:57:49AM -0600, Jens Axboe wrote: > It was just a quick hack, might very well be too eager to go through > those motions. But pondering this instead of sleeping, we don't need to > copy all of iov_iter in order to restore the state, and we can use the > same advance after restoring. So something like this may be more > palatable. Caveat - again untested, and I haven't tested the performance > impact of this at all. You actually can cut it down even more - nr_segs + iov remains constant all along, so you could get away with just 3 words here... I would be surprised if extra memory traffic had shown up - it's well within the noise from register spills, (un)inlining, etc. We are talking about 3 (or 4, with your variant) extra words on one stack frame (and that'd be further offset by removal of ->truncated); I'd still like to see the profiling data, but concerns about extra memory traffic due to that are, IMO, misplaced.