Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp329320ybt; Sat, 13 Jun 2020 05:58:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzegwqRNcntSeoWVuk/2xCl3aWQyTvxMqijv5P236ffGJH8EDFj9SNhCL153U0qfaxA0WME X-Received: by 2002:a50:e881:: with SMTP id f1mr15428420edn.98.1592053108584; Sat, 13 Jun 2020 05:58:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592053108; cv=none; d=google.com; s=arc-20160816; b=qyQNj/oAsqXp5kw+wRYPeuoJcpeMp5Cr5IO4K5GtHZJSs9tY/d5gsUDQhOpGuzxa8U JKZ3iYi+kItsOSb+fwWgZPSla9VZm+lCkRyrx8wlgYMNtnnoFTONuMsVOFMkPhdIhJ+B rkdnNY0R8ueFlpvy25CyiAEDCIdgWiA+2afI6THCgNBE06ZoNHe2bCeROTEZo08O+0Pw bK445YcX60iLNXstCLGfEXlkfRRmsvYt9cfAthVbfTG9uKm/jKG30DHeesaNWSrSncUB Y6aItUk8Wt3GVqOkW9SfQMT51z/SNWWA9N5KUg+xsILbvI5GRtku7oYbMoYWtb4J/60j suzA== 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=m2BsBQM77hIK/oP5xiPovq+z4NHxX2JkBTTkidaTsNU=; b=peRopx5xaVM43/G+8T+2I2FUp6KRXhSPL3OCLB3D8nO4Fb4MCHwYB43Wzd4rrwxkcB Nmqk6OS1bzaQX+NJUMXZmqYoGYShIDiW8DDvtwvj7wHSLyOZkAGhZf2y0wUxpxFgg6p0 UGbZVq3PYJSkPUWPKuef9OJeSbDo4WchWYnXdhx4WBJZOeOgrc13sIm1bDBc2gC0/F7H 51SNRuWUfRLhQlXpUoQAGrZDxt4j3Wmd1ONTbkHPD5pDiTD2QwA4OyA+ZHEWzjZ97VUu QLwEH7muQJWFZH2In3padZQGARd7/d86ECA3Brc3F9whqiKvJq4DH/vO1+mua2vVcsAB nNAQ== 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 f12si5698466edl.157.2020.06.13.05.58.06; Sat, 13 Jun 2020 05:58:28 -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 S1726278AbgFMM4U (ORCPT + 99 others); Sat, 13 Jun 2020 08:56:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726021AbgFMM4U (ORCPT ); Sat, 13 Jun 2020 08:56:20 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA728C03E96F for ; Sat, 13 Jun 2020 05:56:19 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.93 #3 (Red Hat Linux)) id 1jk5hn-008AgX-Br; Sat, 13 Jun 2020 12:56:15 +0000 Date: Sat, 13 Jun 2020 13:56:15 +0100 From: Al Viro To: afzal mohammed Cc: Arnd Bergmann , Russell King - ARM Linux admin , Linus Walleij , "linux-kernel@vger.kernel.org" , Linux-MM , Linux ARM , Nicolas Pitre , Catalin Marinas , Will Deacon Subject: Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic() Message-ID: <20200613125615.GF23230@ZenIV.linux.org.uk> References: <9e1de19f35e2d5e1d115c9ec3b7c3284b4a4e077.1591885760.git.afzal.mohd.ma@gmail.com> <20200612135538.GA13399@afzalpc> <20200613120432.GA5319@afzalpc> <20200613125126.GE23230@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200613125126.GE23230@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 13, 2020 at 01:51:26PM +0100, Al Viro wrote: > On Sat, Jun 13, 2020 at 05:34:32PM +0530, afzal mohammed wrote: > > > Observation is that max. pages reaching copy_{from,to}_user() is 2, > > observed maximum of n (number of bytes) being 1 page size. i think C > > library cuts any size read, write to page size (if it exceeds) & > > invokes the system call. Max. pages reaching 2, happens when 'n' > > crosses page boundary, this has been observed w/ small size request > > as well w/ ones of exact page size (but not page aligned). > > > > Even w/ dd of various size >4K, never is the number of pages required > > to be mapped going greater than 2 (even w/ 'dd' 'bs=1M') > > > > i have a worry (don't know whether it is an unnecessary one): even > > if we improve performance w/ large copy sizes, it might end up in a > > sluggishness w.r.t user experience due to most (hence a high amount) > > of user copy calls being few bytes & there the penalty being higher. > > And benchmark would not be able to detect anything abnormal since > > usercopy are being tested on large sizes. > > > > Quickly comparing boot-time on Beagle Bone White, boot time increases > > by only 4%, perhaps this worry is irrelevant, but just thought will > > put it across. > > Do stat(2) of the same tmpfs file in a loop (on tmpfs, to eliminate > the filesystem playing silly buggers). And I wouldn't expect anything > good there... Incidentally, what about get_user()/put_user()? _That_ is where it's going to really hurt...