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.0 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 EB253C433E0 for ; Sat, 13 Jun 2020 12:04:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C10262078A for ; Sat, 13 Jun 2020 12:04:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MZlEwdlL"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CU6y3HBb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C10262078A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GHLU1U/xn7gguULZnXMeM6/5jyrJcy6rszYwNVOZsms=; b=MZlEwdlLHSnpI5 DQY/8/jxUveUAX7+m5SHB8nx8INcRx5yUiYxWYMhOH6JGEOPxpmghZybPOl6eimimTFQYqpJvE6Mv sb/jCP7VwS9jtxs+H3wlzRfou9H106em0m1+mNb5gqzPfrnyeaJviVXZeqfsEP/hg+6Z7Y1PgDUM6 MMXM4FvBbvzknqtR9SK2FiMpbx9udJYAtIktG+/5Yu2Fax5JjivA0+lFu+Psjk+9+jgleLtPvcoVf S0Xq1EfmC1DywZl2awHQdQhdTb24B7u38sUIR52CnNCh+mQ10q4KYS11Az/PNGsUHPyWMrwM6COXK DDt8/MopkiIjzI8Us9nQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jk4tt-0007JY-MU; Sat, 13 Jun 2020 12:04:41 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jk4tp-0007Ik-TW for linux-arm-kernel@lists.infradead.org; Sat, 13 Jun 2020 12:04:39 +0000 Received: by mail-pg1-x542.google.com with SMTP id u5so5402782pgn.5 for ; Sat, 13 Jun 2020 05:04:36 -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=LBrsfxO25w2eu+lrtvfG2KxIdSA+88lYE5tWiAEH8qM=; b=CU6y3HBbj/n8jNq32wKmlGbKqblgo+cnqIRVSSA2jz7Qn3+T+ejYaQtqm4xEFmL6/t 7doJiv+0cF/A5BVpe3f6BdSc1JNyzs2vtcAU2MdYBNU0z1Z4K6pnnB0OqimD0U9szNeU Y0OGDGOny5I3deJZfLq2iQYSPI6TuvDm35tjCMgWUMDTc7aeUsrQPrVjW0RZJ95djrgM fkOzUadFV2+ZCwOOLy9YPEAaO93mgN37StRybZlo/Gzt53gP7b/6k6Y2+2FIy+KU66uM 8zCY5yan04lXaJw2BW8w52YzWseMaG5U1yaxcdwWAO4LI7vlFWGlp6txNonl2MiiS09l aXlw== 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=LBrsfxO25w2eu+lrtvfG2KxIdSA+88lYE5tWiAEH8qM=; b=rzqiQ366nAcH7aZTonB1wtlMOaWeo+T0t2vpV+q3n8DHNZln25+Eg+aAUBh4O8iBSN NxRaGxRCePMN4BRzGRNaFBFKy2aAcscHOD5EGIaXAVJVSz9iX+uwE91bCi30DTG4C13N WFwXMw5Fou7B4mFbnlxfr/iklpuQE60g0PvB+wdr6fvoSt27pdNWsfYrlA/GHIu61a4l 9Dx0GIwG5vmFMVvaSrs+7S4eb3Oe7gN67wxdYs9z3T1afuOGDV7AALKOleSYkb8Weq9Z gogOgpJeE6cRO9N0zb4TroaoEQMcxsIZicpeLZMMeDeAgNzz72oz0PyY1qulkon/I0Wr l5ZQ== X-Gm-Message-State: AOAM531H7gmpptPVzd2eqbP/J+7TsZfsIjcRxtej+vb9kD7DcNcPjj5T hGhqDWprkNy28u7Z9LBQBnS99t5H X-Google-Smtp-Source: ABdhPJwmpmABGRrQm+OFl+czCBJy5iA0MDun8zYJpfbPLnNUBn63dzGlclRFHTHT74RVa9NQlqsc9Q== X-Received: by 2002:a63:e34a:: with SMTP id o10mr14362568pgj.258.1592049875852; Sat, 13 Jun 2020 05:04:35 -0700 (PDT) Received: from localhost ([49.207.210.132]) by smtp.gmail.com with ESMTPSA id k12sm8778184pfk.219.2020.06.13.05.04.33 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 13 Jun 2020 05:04:35 -0700 (PDT) Date: Sat, 13 Jun 2020 17:34:32 +0530 From: afzal mohammed To: Arnd Bergmann Subject: Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic() Message-ID: <20200613120432.GA5319@afzalpc> References: <9e1de19f35e2d5e1d115c9ec3b7c3284b4a4e077.1591885760.git.afzal.mohd.ma@gmail.com> <20200612135538.GA13399@afzalpc> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200613_050437_972440_ED2A2A96 X-CRM114-Status: GOOD ( 11.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Pitre , Catalin Marinas , Linus Walleij , Russell King - ARM Linux admin , "linux-kernel@vger.kernel.org" , Linux-MM , Will Deacon , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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). 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. > There is also still hope of optimizing small aligned copies like > > set_ttbr0(user_ttbr); > ldm(); > set_ttbr0(kernel_ttbr); > stm(); Hmm, more needs to be done to be in a position to test it. Regards afzal _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 6D9A8C433DF for ; Sat, 13 Jun 2020 12:04:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 29FEA2078A for ; Sat, 13 Jun 2020 12:04:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CU6y3HBb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 29FEA2078A 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 B4C826B0006; Sat, 13 Jun 2020 08:04:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AFC486B000C; Sat, 13 Jun 2020 08:04:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C33A6B000E; Sat, 13 Jun 2020 08:04:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0068.hostedemail.com [216.40.44.68]) by kanga.kvack.org (Postfix) with ESMTP id 831216B0006 for ; Sat, 13 Jun 2020 08:04:37 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 42B701EF1 for ; Sat, 13 Jun 2020 12:04:37 +0000 (UTC) X-FDA: 76924056594.03.hope06_120a92a26de4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 1CF3628A4EB for ; Sat, 13 Jun 2020 12:04:37 +0000 (UTC) X-HE-Tag: hope06_120a92a26de4 X-Filterd-Recvd-Size: 5056 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Sat, 13 Jun 2020 12:04:36 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id x22so5589080pfn.3 for ; Sat, 13 Jun 2020 05:04:36 -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=LBrsfxO25w2eu+lrtvfG2KxIdSA+88lYE5tWiAEH8qM=; b=CU6y3HBbj/n8jNq32wKmlGbKqblgo+cnqIRVSSA2jz7Qn3+T+ejYaQtqm4xEFmL6/t 7doJiv+0cF/A5BVpe3f6BdSc1JNyzs2vtcAU2MdYBNU0z1Z4K6pnnB0OqimD0U9szNeU Y0OGDGOny5I3deJZfLq2iQYSPI6TuvDm35tjCMgWUMDTc7aeUsrQPrVjW0RZJ95djrgM fkOzUadFV2+ZCwOOLy9YPEAaO93mgN37StRybZlo/Gzt53gP7b/6k6Y2+2FIy+KU66uM 8zCY5yan04lXaJw2BW8w52YzWseMaG5U1yaxcdwWAO4LI7vlFWGlp6txNonl2MiiS09l aXlw== 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=LBrsfxO25w2eu+lrtvfG2KxIdSA+88lYE5tWiAEH8qM=; b=KuMTRLpNY0Yf5RFS/RmVHOhnBRMbPMgmbOkreqRYVDBLXuXaeH2DVs7WLuhubmu5H1 Ef7+uFBpPmgJpI4G7Ioavvr3b0z6UUWxScbbaQGCPsRTZ0Kpr/MhqLGeBMKH5ZDxXHZm DKrybdGMcybiJXuGaC9aA6w/oOlslDNTalcNEp4cHqZGjejrXe6h+cqH0q28HDNCESYu zC+Jq5UsNOmBG9rxgeNVcHkatw9LJVQ7Qrg14pHvpHNmnnJ0/IZ6uu0v+3iK7acyBeW2 h3iPHmD34aq1mPg53U7/JDdd0CZoXoA9kIjbNcihFFL7WS0oppDpOFmg0KUwcuQPVB2a WSug== X-Gm-Message-State: AOAM533VYaF+m87NMT/mzIEfsL2RkuxPI/WgpoY/ubcNdTEqPWOu7nUo QFYRCDnl1Rd/JwgEF9cztfs= X-Google-Smtp-Source: ABdhPJwmpmABGRrQm+OFl+czCBJy5iA0MDun8zYJpfbPLnNUBn63dzGlclRFHTHT74RVa9NQlqsc9Q== X-Received: by 2002:a63:e34a:: with SMTP id o10mr14362568pgj.258.1592049875852; Sat, 13 Jun 2020 05:04:35 -0700 (PDT) Received: from localhost ([49.207.210.132]) by smtp.gmail.com with ESMTPSA id k12sm8778184pfk.219.2020.06.13.05.04.33 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 13 Jun 2020 05:04:35 -0700 (PDT) Date: Sat, 13 Jun 2020 17:34:32 +0530 From: afzal mohammed To: Arnd Bergmann Cc: 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: <20200613120432.GA5319@afzalpc> References: <9e1de19f35e2d5e1d115c9ec3b7c3284b4a4e077.1591885760.git.afzal.mohd.ma@gmail.com> <20200612135538.GA13399@afzalpc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) X-Rspamd-Queue-Id: 1CF3628A4EB X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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 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). 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. > There is also still hope of optimizing small aligned copies like > > set_ttbr0(user_ttbr); > ldm(); > set_ttbr0(kernel_ttbr); > stm(); Hmm, more needs to be done to be in a position to test it. Regards afzal