Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1542126pxb; Fri, 10 Sep 2021 08:10:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvHMeen4fYa8z137IXji7wOXnVkrvQyIwaSC+oVwcLY4+cy1OsMc2Z1BZfjnbxi5b4LZTO X-Received: by 2002:a02:ad17:: with SMTP id s23mr4854719jan.135.1631286632320; Fri, 10 Sep 2021 08:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631286632; cv=none; d=google.com; s=arc-20160816; b=Cq1afYQSbw4TvullxiPXfMQBo5iuvI0jLLjSmfR7c6JN7I623R9wNN+QgBTMtCBjHp TeoKNLRRs7sOe2cqPte61gJDerfxNHahTaOg7VdLCZd+217KrplsmIXQVer8bZEEB/gP 2O8PahUJ+72hvC29mdzPcXU0pitcepNf2nTwwabNDj2kDT5exo2/cHapLwCzZMmE4/fM Lx5WnSYNEPgenztzAcZyFf8udJCtR+fkgretfGWXf3QYQLSy+srpbOF3lSfTyDXHmHHk FOfKedTGD2CUs9C30C0ac32xNtsGe/APaR04rdxgeymXL2Ko3bqfQryDuJ4xtPql+Rmv Eprg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=BrxzTCRXFeWgHCONUvuL7grava4MVAVW3Zocp6vU7jo=; b=x5mT7dT262suxLVf9wbHB+kZsyE1ZHiiyMnSkz6U3ZClPDX6ue4pN/j2R+Gtnwcmmd pWnnndG5HhyQpZ2kQJmJ4FOuDkiyoDlRjQvPpjZ2wpqFYSQgyFtZLk3qLVt0wNEPKiRW WIaStXoznwHc5rmUwwgoVFwaD4WwbV0aCuEGrLMQGTV9nunF8Hak4bVNNKVFP118cr9U tYTMSeg3LCPXHd3mVppsdGoxilWMHzuf+lWvSkxJLQkx4mMaBCe2KgLq4KcRgO1vY/M8 sY3TfmAtmIQhfMchRWL+gZj2l4s6eSrbPBFy8sLLs8FZLMYPAcfrwWS6Tq3gtvcejV9h bU2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=my+xizXr; 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 a2si4591504ilp.123.2021.09.10.08.10.19; Fri, 10 Sep 2021 08:10:32 -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; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=my+xizXr; 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 S234155AbhIJPJS (ORCPT + 99 others); Fri, 10 Sep 2021 11:09:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234267AbhIJPJQ (ORCPT ); Fri, 10 Sep 2021 11:09:16 -0400 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AEA2C061574 for ; Fri, 10 Sep 2021 08:08:05 -0700 (PDT) Received: by mail-il1-x132.google.com with SMTP id i13so2364348ilm.4 for ; Fri, 10 Sep 2021 08:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=BrxzTCRXFeWgHCONUvuL7grava4MVAVW3Zocp6vU7jo=; b=my+xizXrJkbSt6xkUqSxuB8Jm0KThrQH0s5xj6MBSAfvx+JU7850qyZgWajaZpDFrT WmFxjKFRXLPGGQ76Q1lwASuTMVAkaHSizZtI2EfNKV6d4iZNjJYZ85U1gVeHVglkkkza JKC0ruBtS2gPVXi8FMRiZjAQ3u0ysMjMA3GaGwsESADei7dpcuDw18KOcdygZtHcVTNU eWOy8ESo4T2oNCniSNpkBg1ID2kcP6DlSVzRIKs9bKmdpBk+BSUiMCZMSaAkDpoyI+ti tytk1h9R2QNkiwz1AsCjQSLQMFBrPL6N6wNULWFWD9LS239T6cXJIAjGUEMFnORQe8tG CRfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=BrxzTCRXFeWgHCONUvuL7grava4MVAVW3Zocp6vU7jo=; b=dsXuQfQYhZk8ZZ4Qa4/pQH/RxbR9yr3HyY76Dvdl5mB1EMWG1xONBFqBWgWGWuOoQi sWbE67QhSa9eHKwX9gIvUpRP48851Q/EG5Y0+yOw0x2iqxJsMMSjwp0wmZ9jp0Mrb9IJ CTk4DFKlw0rzcy4+7y4/p0IpCTbvXqXf3xVBhGBe2UXhrYd+KE9+YK1G7wXGQ0WF4xrD r4RHYl1Qi/qfwrDazpRDZpTsT21T0X4dyVhkYE7FY5JJsAeSZyKvUH7GiV78MfH6hN6Z 6Cddxm45iurm6+WTSMmfrCF4UgfsY7k2pAmlGzEpS3wapOjnPhr85ee/YF3UNTUXp9vo NYpw== X-Gm-Message-State: AOAM531+yVz6/HD68Hsxmgjd6QTYwaoUffCQLxrHEyG4JSuvDuFJoG87 tBuRJRzEBCYC/zUH0s0VFnb/pxdd3CDZUlgOAFE= X-Received: by 2002:a05:6e02:68a:: with SMTP id o10mr6969504ils.72.1631286484904; Fri, 10 Sep 2021 08:08:04 -0700 (PDT) Received: from [192.168.1.30] ([207.135.234.126]) by smtp.gmail.com with ESMTPSA id z16sm2660078ile.72.2021.09.10.08.08.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Sep 2021 08:08:03 -0700 (PDT) Subject: Re: [git pull] iov_iter fixes To: Al Viro Cc: Linus Torvalds , Pavel Begunkov , Linux Kernel Mailing List , linux-fsdevel References: <5971af96-78b7-8304-3e25-00dc2da3c538@kernel.dk> <9ae5f07f-f4c5-69eb-bcb1-8bcbc15cbd09@kernel.dk> <9855f69b-e67e-f7d9-88b8-8941666ab02f@kernel.dk> From: Jens Axboe Message-ID: <75caf6d6-26d4-7146-c497-ed89b713d878@kernel.dk> Date: Fri, 10 Sep 2021 09:08:02 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/10/21 8:42 AM, Al Viro wrote: > 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 Mmm, the iov pointer remains constant? Maybe I'm missing your point, but the various advance functions are quite happy to increment iter->iov or iter->bvec, so we need to restore them. From a quick look, looks like iter->nr_segs is modified for advancing too. What am I missing? > 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. See other email that was just sent out, it is measurable but pretty minimal. But that's also down to about 1/3rd of copying the whole thing blindly, so definitely a better case. -- Jens Axboe