From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98FD6C433E0 for ; Sun, 14 Jun 2020 13:06:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5DDFA206D7 for ; Sun, 14 Jun 2020 13:06:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="onBIBYT4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DDFA206D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DFA086B002E; Sun, 14 Jun 2020 09:06:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DAB276B002F; Sun, 14 Jun 2020 09:06:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C99626B0030; Sun, 14 Jun 2020 09:06:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0099.hostedemail.com [216.40.44.99]) by kanga.kvack.org (Postfix) with ESMTP id AF3CD6B002E for ; Sun, 14 Jun 2020 09:06:39 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 67CDC181ABE89 for ; Sun, 14 Jun 2020 13:06:39 +0000 (UTC) X-FDA: 76927841718.30.jelly53_0b0bfe226ded Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 41B90180B3C83 for ; Sun, 14 Jun 2020 13:06:39 +0000 (UTC) X-HE-Tag: jelly53_0b0bfe226ded X-Filterd-Recvd-Size: 4659 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Sun, 14 Jun 2020 13:06:38 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id j6so2467488pgh.4 for ; Sun, 14 Jun 2020 06:06:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tbNPHbcJdd9Zy5vpitc4It2x0QhJhg6ckwY09//qr6Y=; b=onBIBYT4ViSU7ygp5zYYYBkpUleSF5iOdLkVHxQBdUzs6HwG5FPU2AJIL94jiO1/3q e611vI3yaKJGxZt2s4y6snRpXKvWJq8OqYUJjwVNmgfG7HHqxMRpPNskzZb5sxAjWHjY xnRzeKS3IREF5B9/QGpTyAwqFLQY/nYBHWJAnL9xC8VVruuUd86ny7YZy0CwYO06X5JA S87sPGgfHf0Of2/wEO3Lf7D81x16zacDo1gKx/WP3icE0P4D0ZRLXudAyfnGbhm2eAFX FoESIv6H9gYq4R8Kg1xRHUcUxg6EpkTgR8UX8haSscXC6Q7aRYqatXBg5s4wlT6QdIlv AbXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tbNPHbcJdd9Zy5vpitc4It2x0QhJhg6ckwY09//qr6Y=; b=qx+eul75ScH7jBtnmw5W/vTv6pzbyz7EwQORrUhox3fI0UG71OzA969s0OEXpF7rRk YcJyXKei1B7V3ubfUfw3XRz6i4gVEi7UKhTdf03+0Im91kc6HOTCQ37k2Te5w29YMQlR D3mke+C7Vn9JSRS5ckP3fjYXDnGr4J2I/r0fUghiZpY+pYO9f+YQDUxmzhqKCyHrzQuN yxDuc4aKaqW+YEvTgKctiRgUNliu+a7WN9lCzv3eIRneJL6jYKB683qytbH4FBKCupx/ OK+Xv4QDb08ex1BHBvF1snw+JZxAc45HrEvQuHTggUwXxWmNNKQYdNUQSzEylq4o/meo kixg== X-Gm-Message-State: AOAM5338m+oR4LA5lLwQKeNsodPJk9mmU/BNiAI7brGVziLnLuJqbefc 73Tg0mFlZyeMBqzaB4d7rKM= X-Google-Smtp-Source: ABdhPJzSwp75HDSJw1OL5kd4Rpdjmi7CLAzvE7VPRCs+dMV7al78Ke9fy4XDN78px0l2mL6bUhjXnw== X-Received: by 2002:a63:4861:: with SMTP id x33mr109880pgk.448.1592139997958; Sun, 14 Jun 2020 06:06:37 -0700 (PDT) Received: from localhost ([49.207.199.244]) by smtp.gmail.com with ESMTPSA id y10sm9811760pgi.54.2020.06.14.06.06.37 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Jun 2020 06:06:37 -0700 (PDT) Date: Sun, 14 Jun 2020 18:36:35 +0530 From: afzal mohammed To: Russell King - ARM Linux admin 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: <20200614130635.GA5037@afzalpc> References: <9e1de19f35e2d5e1d115c9ec3b7c3284b4a4e077.1591885760.git.afzal.mohd.ma@gmail.com> <20200612135538.GA13399@afzalpc> <20200613120432.GA5319@afzalpc> <20200613131552.GL1551@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200613131552.GL1551@shell.armlinux.org.uk> User-Agent: Mutt/1.9.3 (2018-01-21) X-Rspamd-Queue-Id: 41B90180B3C83 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi, On Sat, Jun 13, 2020 at 02:15:52PM +0100, Russell King - ARM Linux admin wrote: > On Sat, Jun 13, 2020 at 05:34:32PM +0530, afzal mohammed wrote: > > i think C > > library cuts any size read, write to page size (if it exceeds) & > > invokes the system call. > 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 Okay. Yes, observed that dd is passing whatever is the 'bs' to Kernel and from the 'dd' sources (of busybox), it is invoking read system call directly passing 'bs', so it is the tmpfs read that is splitting it to page size as mentioned by Arnd. Regards afzal