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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 672FCC433F5 for ; Sat, 9 Apr 2022 05:07:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239367AbiDIFJd (ORCPT ); Sat, 9 Apr 2022 01:09:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241916AbiDIFIt (ORCPT ); Sat, 9 Apr 2022 01:08:49 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF2FB1D9146; Fri, 8 Apr 2022 22:06:42 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id AB9CC68AFE; Sat, 9 Apr 2022 07:06:38 +0200 (CEST) Date: Sat, 9 Apr 2022 07:06:38 +0200 From: Christoph Hellwig To: Hugh Dickins Cc: Andrew Morton , Chuck Lever III , Mark Hemment , Patrice CHOTARD , Mikulas Patocka , Lukas Czerner , Christoph Hellwig , "Darrick J. Wong" , linux-mm@kvack.org, linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, viro@zeniv.linux.org.uk Subject: Re: [PATCH] tmpfs: fix regressions from wider use of ZERO_PAGE Message-ID: <20220409050638.GB17755@lst.de> References: <9a978571-8648-e830-5735-1f4748ce2e30@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9a978571-8648-e830-5735-1f4748ce2e30@google.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 08, 2022 at 01:38:41PM -0700, Hugh Dickins wrote: > + } else if (iter_is_iovec(to)) { > + /* > + * Copy to user tends to be so well optimized, but > + * clear_user() not so much, that it is noticeably > + * faster to copy the zero page instead of clearing. > + */ > + ret = copy_page_to_iter(ZERO_PAGE(0), offset, nr, to); Is the offset and length guaranteed to be less than PAGE_SIZE here? Either way I'd rather do this optimization in iov_iter_zero rather than hiding it in tmpfs.