Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3768898pxu; Sun, 11 Oct 2020 23:57:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy08G1QaqTVEZFtU7vsd40PsMpORlSK6Apo147TRcVnN1dxLRO4OG5V5eHVXk2U4CQ2RMOu X-Received: by 2002:a17:906:3716:: with SMTP id d22mr26801659ejc.267.1602485876733; Sun, 11 Oct 2020 23:57:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602485876; cv=none; d=google.com; s=arc-20160816; b=Ll1jEaPHtyO/kCeA4pjdG8GtzLQVDxFUK/7cEKady9OUT7adt07k+oqioUKe4kQfor +ZPBaJwjKPoFZy5AjsQUJ6bugK15k2e6GDVvCboLDQIfI1zpkjRNGajBmw2Ecb2dBYrO VohU8fUpqMqt4ydAGdbLgzGhySI9neaid6jz+YbD0UIsWKNtaFYsr5Kl9AJRks8CjSH/ DcPFCbWyJ8WXoeKt5jrn6xPeFvQrrP93K6uKO+0f8P4sddnzLoaBbD34q+RlJ9wAJQZp zVlDpxFBxWQQuEAguhDZx3ZUlmu++iQleimAfV6aG8P0pWv+a3VhlPd2LDW5mOXLZvcJ Kp3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=+vEz9GLCWbayKOJC9stQnVHWgE9c4nWrUY4betrwq+c=; b=jAVVwzosFrDDHPur1ieeX1mBT+9FS476CyXRFA1Tc93/8b9noj8SIByOUiVMgSJrwj ODHjuupWtLOikONfffLMwo9Czcxmht0hBowWxvYh3UxsF3b+8StjmbBY9zlBiUTRwqLY Yt6/6P1FVjLRrGS/fc8omTn21sCcRRHjtTI0YmgcaLAeE5ZAbxqb4SGGCV3+aIq/uj02 /vrV5YfR12/SWK6RkRIKaEf4cGJfueUk2IJ/0czYv8MP1u64nmOFXE/NI9eE7qby68YE JZ6c/otq2uUu8Mol9XiToxGmy2ITCoNQwB5S6Hhaqd/CjAY4c6aWZba/raBKz8ng1TcK 7Ijg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x18si11771540edl.321.2020.10.11.23.57.24; Sun, 11 Oct 2020 23:57:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726768AbgJLG4r (ORCPT + 99 others); Mon, 12 Oct 2020 02:56:47 -0400 Received: from mga11.intel.com ([192.55.52.93]:8586 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbgJLG4p (ORCPT ); Mon, 12 Oct 2020 02:56:45 -0400 IronPort-SDR: KdOQg+ZBqIiV/ltrco9eP5XufL+zHKA8feyxTD5Z0KzKXfiHluIayIhHF5kMMjoAONeEwr8w70 b6av5HCblNFg== X-IronPort-AV: E=McAfee;i="6000,8403,9771"; a="162232222" X-IronPort-AV: E=Sophos;i="5.77,366,1596524400"; d="scan'208";a="162232222" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2020 23:56:37 -0700 IronPort-SDR: DSpSIoZKV7KPLq4zxFvBA+ZLKNkpgmuUQCwMmUi8wsqk6OFxxWBKXoVpyUUZRY9EN2DChpPczf 4EPhWIQlBVGQ== X-IronPort-AV: E=Sophos;i="5.77,366,1596524400"; d="scan'208";a="529842687" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2020 23:56:35 -0700 Date: Sun, 11 Oct 2020 23:56:35 -0700 From: Ira Weiny To: Eric Biggers Cc: Matthew Wilcox , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Peter Zijlstra , linux-aio@kvack.org, linux-efi@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-mmc@vger.kernel.org, Dave Hansen , dri-devel@lists.freedesktop.org, linux-mm@kvack.org, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kselftest@vger.kernel.org, samba-technical@lists.samba.org, ceph-devel@vger.kernel.org, drbd-dev@lists.linbit.com, devel@driverdev.osuosl.org, linux-cifs@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, linux-nvdimm@lists.01.org, linux-rdma@vger.kernel.org, x86@kernel.org, amd-gfx@lists.freedesktop.org, linux-afs@lists.infradead.org, cluster-devel@redhat.com, linux-cachefs@redhat.com, intel-wired-lan@lists.osuosl.org, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, Fenghua Yu , ecryptfs@vger.kernel.org, linux-um@lists.infradead.org, intel-gfx@lists.freedesktop.org, linux-erofs@lists.ozlabs.org, reiserfs-devel@vger.kernel.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, Jaegeuk Kim , Dan Williams , io-uring@vger.kernel.org, linux-nfs@vger.kernel.org, linux-ntfs-dev@lists.sourceforge.net, netdev@vger.kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, bpf@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-btrfs@vger.kernel.org Subject: Re: [PATCH RFC PKS/PMEM 22/58] fs/f2fs: Utilize new kmap_thread() Message-ID: <20201012065635.GB2046448@iweiny-DESK2.sc.intel.com> References: <20201009195033.3208459-1-ira.weiny@intel.com> <20201009195033.3208459-23-ira.weiny@intel.com> <20201009213434.GA839@sol.localdomain> <20201010003954.GW20115@casper.infradead.org> <20201010013036.GD1122@sol.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201010013036.GD1122@sol.localdomain> User-Agent: Mutt/1.11.1 (2018-12-01) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Fri, Oct 09, 2020 at 06:30:36PM -0700, Eric Biggers wrote: > On Sat, Oct 10, 2020 at 01:39:54AM +0100, Matthew Wilcox wrote: > > On Fri, Oct 09, 2020 at 02:34:34PM -0700, Eric Biggers wrote: > > > On Fri, Oct 09, 2020 at 12:49:57PM -0700, ira.weiny@intel.com wrote: > > > > The kmap() calls in this FS are localized to a single thread. To avoid > > > > the over head of global PKRS updates use the new kmap_thread() call. > > > > > > > > @@ -2410,12 +2410,12 @@ static inline struct page *f2fs_pagecache_get_page( > > > > > > > > static inline void f2fs_copy_page(struct page *src, struct page *dst) > > > > { > > > > - char *src_kaddr = kmap(src); > > > > - char *dst_kaddr = kmap(dst); > > > > + char *src_kaddr = kmap_thread(src); > > > > + char *dst_kaddr = kmap_thread(dst); > > > > > > > > memcpy(dst_kaddr, src_kaddr, PAGE_SIZE); > > > > - kunmap(dst); > > > > - kunmap(src); > > > > + kunmap_thread(dst); > > > > + kunmap_thread(src); > > > > } > > > > > > Wouldn't it make more sense to switch cases like this to kmap_atomic()? > > > The pages are only mapped to do a memcpy(), then they're immediately unmapped. > > > > Maybe you missed the earlier thread from Thomas trying to do something > > similar for rather different reasons ... > > > > https://lore.kernel.org/lkml/20200919091751.011116649@linutronix.de/ > > I did miss it. I'm not subscribed to any of the mailing lists it was sent to. > > Anyway, it shouldn't matter. Patchsets should be standalone, and not require > reading random prior threads on linux-kernel to understand. Sorry, but I did not think that the discussion above was directly related. If I'm not mistaken, Thomas' work was directed at relaxing kmap_atomic() into kmap_thread() calls. While interesting, it is not the point of this series. I want to restrict kmap() callers into kmap_thread(). For this series it was considered to change the kmap_thread() call sites to kmap_atomic(). But like I said in the cover letter kmap_atomic() is not the same semantic. It is too strict. Perhaps I should have expanded that explanation. > > And I still don't really understand. After this patchset, there is still code > nearly identical to the above (doing a temporary mapping just for a memcpy) that > would still be using kmap_atomic(). I don't understand. You mean there would be other call sites calling: kmap_atomic() memcpy() kunmap_atomic() ? > Is the idea that later, such code will be > converted to use kmap_thread() instead? If not, why use one over the other? The reason for the new call is that with PKS added behind kmap we have 3 levels of mapping we want. global kmap (can span threads and sleep) 'thread' kmap (can sleep but not span threads) 'atomic' kmap (can't sleep nor span threads [by definition]) As Matthew said perhaps 'global kmaps' may be best changed to vmaps? I just don't know the details of every call site. And since I don't know the call site details if there are kmap_thread() calls which are better off as kmap_atomic() calls I think it is worth converting them. But I made the assumption that kmap users would already be calling kmap_atomic() if they could (because it is more efficient). Ira