Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2603632pxu; Sat, 10 Oct 2020 00:56:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkwkkfoLnPHdIf+TL3U8P7nkXhN4XDG70uR+li4n4P+CNfA0R3ppl3joILqheGoi6qzPVl X-Received: by 2002:aa7:dcd6:: with SMTP id w22mr3260056edu.378.1602316609810; Sat, 10 Oct 2020 00:56:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602316609; cv=none; d=google.com; s=arc-20160816; b=uTxVt8LfefuudNbKgJ87WsrCJnA6MP+Z7diGfdP0GJpP4H3T9zP3kAROmZ52iKcmtc 1073xC9mu14UCY6HLcaskxAk94di/cW4WOy7k2CJDUVhxfa0KxhOH1YPbfkb57vQGQXA ezASFwkRTfsenXmQbsLJaGb+O0RFBVoh/qJuL4SdITomJ6t0mK2ISlyf7qOriddgCvUq +hHdONWA96Igu8tUzzJnjMGiv+8dS6VTqOwqYf3ohyjnGv+lb62B2/ytluZuF8EQBm/K RajoqFmwm8m+V/ue1RdvaH3aD+Yn/T2B8N19/gbTFQFOChPITOVqWM1FIUY31riGN/Ue /XZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:autocrypt:from :references:cc:to:subject; bh=9tJgjsaNfTp6BtOtmea+IKorfbDbZoEEmKqnYrMYN84=; b=dado+F9kX3gTd8zjxBSkzzlwmzJZiU3taovrLrm+kt9d9qKwtepu/wNaOot7FyEbYG 1R3HMt/PbrPERmHH7cPGmKJJmRPvgep2by6EXl9q2V3fTTFS2K5zIzuMbOI6jt68eFZY T+CGZpj+KybOXnuVyd/e3FESFFkUEfUeYpRbpSgSkN5gZElHyDmATLSiIRDurJfRQSNY denNVTZR0DfmR+MjOFIU9aeXtoRW6Y+/1cHqNDZn3N9U/YaMB10xNYCYqUtwt5SasP74 opQEQ/jtarHFToUuMaVrihTThiQtLmG1quOYiPxiph6lyXgygBP1mk7BBWq3xcD6TlIw O01g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p14si550661edx.418.2020.10.10.00.56.26; Sat, 10 Oct 2020 00:56:49 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730406AbgJJCaN (ORCPT + 99 others); Fri, 9 Oct 2020 22:30:13 -0400 Received: from mx2.suse.de ([195.135.220.15]:54340 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730285AbgJJCU6 (ORCPT ); Fri, 9 Oct 2020 22:20:58 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B0EF9AC65; Sat, 10 Oct 2020 02:20:53 +0000 (UTC) Subject: Re: [PATCH RFC PKS/PMEM 48/58] drivers/md: Utilize new kmap_thread() To: ira.weiny@intel.com Cc: Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Peter Zijlstra , Kent Overstreet , x86@kernel.org, Dave Hansen , Dan Williams , Fenghua Yu , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, kexec@lists.infradead.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org, devel@driverdev.osuosl.org, linux-efi@vger.kernel.org, linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-aio@kvack.org, io-uring@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-um@lists.infradead.org, linux-ntfs-dev@lists.sourceforge.net, reiserfs-devel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-nilfs@vger.kernel.org, cluster-devel@redhat.com, ecryptfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-afs@lists.infradead.org, linux-rdma@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, drbd-dev@lists.linbit.com, linux-block@vger.kernel.org, xen-devel@lists.xenproject.org, linux-cachefs@redhat.com, samba-technical@lists.samba.org, intel-wired-lan@lists.osuosl.org References: <20201009195033.3208459-1-ira.weiny@intel.com> <20201009195033.3208459-49-ira.weiny@intel.com> From: Coly Li Autocrypt: addr=colyli@suse.de; keydata= mQINBFYX6S8BEAC9VSamb2aiMTQREFXK4K/W7nGnAinca7MRuFUD4JqWMJ9FakNRd/E0v30F qvZ2YWpidPjaIxHwu3u9tmLKqS+2vnP0k7PRHXBYbtZEMpy3kCzseNfdrNqwJ54A430BHf2S GMVRVENiScsnh4SnaYjFVvB8SrlhTsgVEXEBBma5Ktgq9YSoy5miatWmZvHLFTQgFMabCz/P j5/xzykrF6yHo0rHZtwzQzF8rriOplAFCECp/t05+OeHHxjSqSI0P/G79Ll+AJYLRRm9til/ K6yz/1hX5xMToIkYrshDJDrUc8DjEpISQQPhG19PzaUf3vFpmnSVYprcWfJWsa2wZyyjRFkf J51S82WfclafNC6N7eRXedpRpG6udUAYOA1YdtlyQR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3c2XK1MUe056yPpNAT2XPNF2EEBPG2Y2F4vLgEbPv1EtpGUS1+JvmK3APxjXUl5z 6xrxCQDWM5AAtGfM/IswVjbZYSJYyH4BQKrShzMb0rWUjkpXvvjsjt8rEXpZEYJgX9jvCoxt oqjCKiVLpwje9WkEe9O9VxljmPvxAhVqJjX62S+TGp93iD+mvpCoHo3+CcvyRcilz+Ko8lfO hS9tYT0HDUiDLvpUyH1AR2xW9RGDevGfwGTpF0K6cLouqyZNdhlmNciX48tFUGjakRFsxRmX K0Jx4CEZubakJe+894sX6pvNFiI7qUUdB882i5GR3v9ijVPhaMr8oGuJ3kvwBIA8lvRBGVGn 9xvzkQ8Prpbqh30I4NMp8MjFdkwCN6znBKPHdjNTwE5PRZH0S9J0o67IEIvHfH0eAWAsgpTz +jwc7VKH7vkvgscUhq/v1/PEWCAqh9UHy7R/jiUxwzw/288OpgO+i+2l11Y= Message-ID: Date: Sat, 10 Oct 2020 10:20:34 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20201009195033.3208459-49-ira.weiny@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/10/10 03:50, ira.weiny@intel.com wrote: > From: Ira Weiny > > These kmap() calls are localized to a single thread. To avoid the over > head of global PKRS updates use the new kmap_thread() call. > Hi Ira, There were a number of options considered. 1) Attempt to change all the thread local kmap() calls to kmap_atomic() 2) Introduce a flags parameter to kmap() to indicate if the mapping should be global or not 3) Change ~20-30 call sites to 'kmap_global()' to indicate that they require a global mapping of the pages 4) Change ~209 call sites to 'kmap_thread()' to indicate that the mapping is to be used within that thread of execution only I copied the above information from patch 00/58 to this message. The idea behind kmap_thread() is fine to me, but as you said the new api is very easy to be missed in new code (even for me). I would like to be supportive to option 2) introduce a flag to kmap(), then we won't forget the new thread-localized kmap method, and people won't ask why a _thread() function is called but no kthread created. Thanks. Coly Li > Cc: Coly Li (maintainer:BCACHE (BLOCK LAYER CACHE)) > Cc: Kent Overstreet (maintainer:BCACHE (BLOCK LAYER CACHE)) > Signed-off-by: Ira Weiny > --- > drivers/md/bcache/request.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c > index c7cadaafa947..a4571f6d09dd 100644 > --- a/drivers/md/bcache/request.c > +++ b/drivers/md/bcache/request.c > @@ -44,10 +44,10 @@ static void bio_csum(struct bio *bio, struct bkey *k) > uint64_t csum = 0; > > bio_for_each_segment(bv, bio, iter) { > - void *d = kmap(bv.bv_page) + bv.bv_offset; > + void *d = kmap_thread(bv.bv_page) + bv.bv_offset; > > csum = bch_crc64_update(csum, d, bv.bv_len); > - kunmap(bv.bv_page); > + kunmap_thread(bv.bv_page); > } > > k->ptr[KEY_PTRS(k)] = csum & (~0ULL >> 1); >