Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2201010pxb; Mon, 11 Jan 2021 03:48:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyywa1ywMH4xPTGz6R8mp6HKfkPRe3d5crmH5g4cCO5vtYrWS81q4VkwY31j46anID5sgYa X-Received: by 2002:aa7:c60c:: with SMTP id h12mr14014223edq.145.1610365735572; Mon, 11 Jan 2021 03:48:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610365735; cv=none; d=google.com; s=arc-20160816; b=of7qOBpBtJmAQ+f6c0fFuUdnBgJcAu1KD92dDC8Y0ugIyaOzVYd4t0keIfrHlyei6W slEhHNohzbzk/aizTp0FJGylcmLxv6+lpiE0UWlEmziRqBE1KkyVmGyDrb9tp68KxRtc b7QYbrZaZ/gRKuboWio4v0h7AwTEI/esoulZvp1X7yoPjhD+u1HTY7fFIh1AbQ8qjsFR g5QKqqfwsDrSAsk0ioc2SHifQ6fcrf7NV1GEfI6qXHU7FSlPUWCE27V1KII3owiR9qDg UEGR1Ze09yeCjRZLkb+I3xLaNhhz1ceBQXjFp9VZWTCd0IgV65iefVUHwjzmWicpiBNB VPBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=/Hcdfw5VdpoOwIxyvr0g1FbdByZ5Ha2c5UYqhxzG0vE=; b=i2W3FPa+EAMQt9AeflahB6AuViykIw6EHZ7SRuFH7ozGGaaAva41Pt2IjF5e+5F2qP fbAYUuAk+OBMyypnlWjrRNFN6abyjgT+BUjbmJJr2uw0uuK9l82OEnX/L9lXW4rxTAoI ss14EcZ6DsdeMJ2wcIEpewKBxNaI2t+bdpHTjr96dgHZcvcsxdVfF8n51b9mK/70Nb7n v5uPVyyl3VhRoq6iP/f33dnih577t0sux8OlaIt/FoZcFAlfWUwntFRYTT/t2HBxPO+t V2gdCzhKtNUVYVhlcIWiH84FX70in2AbvR18oqMF2AbXCXTvthVVOIwshwQb6at/LVpt nK/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MTJlaWcA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 15si6709120ejg.14.2021.01.11.03.48.31; Mon, 11 Jan 2021 03:48:55 -0800 (PST) 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=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MTJlaWcA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730019AbhAKLpp (ORCPT + 99 others); Mon, 11 Jan 2021 06:45:45 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35821 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729792AbhAKLpp (ORCPT ); Mon, 11 Jan 2021 06:45:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610365458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/Hcdfw5VdpoOwIxyvr0g1FbdByZ5Ha2c5UYqhxzG0vE=; b=MTJlaWcA+IKmjRrznQw5x6Az77b24rw1ML23iogus1llC1EMFQcicb/w3Ejmfsx09Xmr2G yPNHXbuLwsS2EnNGhS6eTIonFCmNhCcb62BG9u6fVIUw2KD/DIJV9bvfydotPRZ9jFyXEl v9mIBx4U9mO64FJ7mGP9bB3aXHWjAYg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-229-PFxPmiI0PCK_U1RyLxwyqQ-1; Mon, 11 Jan 2021 06:44:14 -0500 X-MC-Unique: PFxPmiI0PCK_U1RyLxwyqQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4999D801B13; Mon, 11 Jan 2021 11:44:11 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D1E63106D5B9; Mon, 11 Jan 2021 11:44:10 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id 10BBiAnB005247; Mon, 11 Jan 2021 06:44:10 -0500 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id 10BBi9Af005243; Mon, 11 Jan 2021 06:44:10 -0500 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Mon, 11 Jan 2021 06:44:09 -0500 (EST) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: David Laight cc: "'Al Viro'" , Andrew Morton , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Matthew Wilcox , Jan Kara , Steven Whitehouse , Eric Sandeen , Dave Chinner , "Theodore Ts'o" , Wang Jianchao , "Kani, Toshi" , "Norton, Scott J" , "Tadakamadla, Rajesh" , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-nvdimm@lists.01.org" Subject: RE: [RFC v2] nvfs: a filesystem for persistent memory In-Reply-To: Message-ID: References: <20210110162008.GV3579531@ZenIV.linux.org.uk> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 11 Jan 2021, David Laight wrote: > From: Al Viro On Behalf Of Al Viro > > Sent: 10 January 2021 16:20 > > > > On Thu, Jan 07, 2021 at 08:15:41AM -0500, Mikulas Patocka wrote: > > > Hi > > > > > > I announce a new version of NVFS - a filesystem for persistent memory. > > > http://people.redhat.com/~mpatocka/nvfs/ > > Utilities, AFAICS > > > > > git://leontynka.twibright.com/nvfs.git > > Seems to hang on git pull at the moment... Do you have it anywhere else? > > > > > I found out that on NVFS, reading a file with the read method has 10% > > > better performance than the read_iter method. The benchmark just reads the > > > same 4k page over and over again - and the cost of creating and parsing > > > the kiocb and iov_iter structures is just that high. > > > > Apples and oranges... What happens if you take > > > > ssize_t read_iter_locked(struct file *file, struct iov_iter *to, loff_t *ppos) > > { > > struct inode *inode = file_inode(file); > > struct nvfs_memory_inode *nmi = i_to_nmi(inode); > > struct nvfs_superblock *nvs = inode->i_sb->s_fs_info; > > ssize_t total = 0; > > loff_t pos = *ppos; > > int r; > > int shift = nvs->log2_page_size; > > size_t i_size; > > > > i_size = inode->i_size; > > if (pos >= i_size) > > return 0; > > iov_iter_truncate(to, i_size - pos); > > > > while (iov_iter_count(to)) { > > void *blk, *ptr; > > size_t page_mask = (1UL << shift) - 1; > > unsigned page_offset = pos & page_mask; > > unsigned prealloc = (iov_iter_count(to) + page_mask) >> shift; > > unsigned size; > > > > blk = nvfs_bmap(nmi, pos >> shift, &prealloc, NULL, NULL, NULL); > > if (unlikely(IS_ERR(blk))) { > > r = PTR_ERR(blk); > > goto ret_r; > > } > > size = ((size_t)prealloc << shift) - page_offset; > > ptr = blk + page_offset; > > if (unlikely(!blk)) { > > size = min(size, (unsigned)PAGE_SIZE); > > ptr = empty_zero_page; > > } > > size = copy_to_iter(to, ptr, size); > > if (unlikely(!size)) { > > r = -EFAULT; > > goto ret_r; > > } > > > > pos += size; > > total += size; > > } while (iov_iter_count(to)); > > That isn't the best formed loop! > > David I removed the second "while" statement and fixed the arguments to copy_to_iter - other than that, Al's function works. Mikuklas