Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp344410ybt; Sat, 13 Jun 2020 06:20:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxK/2Er8sk9vki7N6At35AhUPG4I8lnGiwCW5Z3daXqsCCK8eNoVsg1ztpMARoy2Ua+NxD4 X-Received: by 2002:aa7:d2d9:: with SMTP id k25mr16599253edr.43.1592054453621; Sat, 13 Jun 2020 06:20:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592054453; cv=none; d=google.com; s=arc-20160816; b=w+GR6uyK2q21EL6qlsdyKOsFmwpOJJEKiogOtIn7hwjqJCqAgXLFyxZSS5T1UZRZLX 0luaeG9rJa866mER0GkZ3HL+7YVc22W36t6ymQLS4PPLEWabZRLkub0bS9XygXt1gQNj VckJpEri1XuIhSUt105LFHL6J0JlfD20QRiYIy3KRnThT9IRmARsKJqg/TVHa+o890ZX e0O9d6l3XUw0JlDJ2U1rSa5Mqxrmhgwrc64he2HY4CffXFJ2e8H7/kFDlNS84m67Zngf Wqhup4irP8UP+yjE1dXZ0+AGfGqiqWdrvkybo5rtZOzMujKsdjHsE44oCf2By7VqpydO HaDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=CTgyUwh6cSz/c+OXjJ8SE3+Fh1Nd5s6JFCqdOiRWMDc=; b=XAFKK2gHIHwtjS6UsYZDyCBrkQoiw/5+wNNh1hy07ygFVBFEGZBQ+koBPuZAhdMtqf qIUKxqygJUfBvomG/UFfLPCWYse4upSfQqIe4KRsSCNwvwv8Bv9f77/D80EnRetNGxLJ pbPeJlG1uI1cUJ4GeIeyoDbG/FUftWJ0RRk7xIgDJjl+leHP1ZZmK3dHZjshOB8gB0G/ wO9UVDY4NpSrbcoMz/xWf88Irgcf059lpFKcpXGMaJag2e9xBmeDNv8lVQBkrxX594kW 8JsSXse+Y26kEAth71v2HXYVZ3dotK2x0UZBtwW+XpdskokdbGDX1gJ33A9hvjpbTHOK 9Kzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=ja4aLfUr; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz17si5810624ejc.605.2020.06.13.06.20.29; Sat, 13 Jun 2020 06:20:53 -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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=ja4aLfUr; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726277AbgFMNQa (ORCPT + 99 others); Sat, 13 Jun 2020 09:16:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726021AbgFMNQ3 (ORCPT ); Sat, 13 Jun 2020 09:16:29 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:214:fdff:fe10:1be6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C7D1C03E96F for ; Sat, 13 Jun 2020 06:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=CTgyUwh6cSz/c+OXjJ8SE3+Fh1Nd5s6JFCqdOiRWMDc=; b=ja4aLfUrZeDtb/Q+hi9fniI0n oDUic4OelYU8+sBynGEk2HzV/Ov9l9/uO5FV6IoNCS3f7i1NHN20jS6OCla7IX1f3zbLTCvXjFunV eyqoKi8AgqM/krztw6qZhGDJDwzLqzpn0hFEQhvsqiui8XVEzhR4KHuj9QlmEiw8Z898MGuh+MYzO yAC1qt7vE2TLy7JQfPmzmoOhZdsEWNiB4+b1SXN3t+TexgESaR4MwHPpxaTVOTD5tP45yoUWH7WLc m/5tNdo5HtvwcjOo+pCYohEuwEpbvpuiMGtwDBZ7cURslG8zRUeKZpukT5nXqjH23RafeSgA2QC0s Kov0DeIXA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:51576) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jk60y-0005SM-Pj; Sat, 13 Jun 2020 14:16:08 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1jk60m-0007LO-M9; Sat, 13 Jun 2020 14:15:52 +0100 Date: Sat, 13 Jun 2020 14:15:52 +0100 From: Russell King - ARM Linux admin To: afzal mohammed Cc: Arnd Bergmann , Nicolas Pitre , Catalin Marinas , Linus Walleij , "linux-kernel@vger.kernel.org" , Linux-MM , Will Deacon , Linux ARM Subject: Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic() Message-ID: <20200613131552.GL1551@shell.armlinux.org.uk> References: <9e1de19f35e2d5e1d115c9ec3b7c3284b4a4e077.1591885760.git.afzal.mohd.ma@gmail.com> <20200612135538.GA13399@afzalpc> <20200613120432.GA5319@afzalpc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200613120432.GA5319@afzalpc> User-Agent: Mutt/1.10.1 (2018-07-13) 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 05:34:32PM +0530, afzal mohammed wrote: > Hi, > > On Fri, Jun 12, 2020 at 10:07:28PM +0200, Arnd Bergmann wrote: > > > I think a lot > > of usercopy calls are only for a few bytes, though this is of course > > highly workload dependent and you might only care about the large > > ones. > > 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). You can't make that assumption about read(2). stdio in the C library may read a page size of data at a time, but programs are allowed to call read(2) directly, and the C library will pass such a call straight through to the kernel. So, if userspace requests a 16k read via read(2), then read(2) will be invoked covering 16k. As an extreme case, for example: $ strace -e read dd if=/dev/zero of=/dev/null bs=1048576 count=1 read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576 -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!