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 E3152C433FE for ; Wed, 19 Oct 2022 15:43:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232561AbiJSPn0 (ORCPT ); Wed, 19 Oct 2022 11:43:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232543AbiJSPm5 (ORCPT ); Wed, 19 Oct 2022 11:42:57 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D3AD253 for ; Wed, 19 Oct 2022 08:38:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666193857; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uJgUGdP9bYvZIOV3EOD94qJlIp07nsvR0mC6+RMMZoE=; b=Piwd+ONMsuJxGNHayrEH2+Mwl7QYCJMFZcvA3M4pJ4aTMVNTkXWi3P+Hdw029htZzRvs0r ZZkjo1FKHc/jwRJFnJWz8fjaDRvAoCRFBSMd2/sd7UW1+GXKzGNNwLYXlEHuNlDFWx+xK/ PmD2swCmh6MVj0hTnThPtYXirsDvVMs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-453-0M44RRZWN8CxvzyEJ3M31Q-1; Wed, 19 Oct 2022 11:37:32 -0400 X-MC-Unique: 0M44RRZWN8CxvzyEJ3M31Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AE2031033663; Wed, 19 Oct 2022 15:37:31 +0000 (UTC) Received: from segfault.boston.devel.redhat.com (segfault.boston.devel.redhat.com [10.19.60.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E5452166B41; Wed, 19 Oct 2022 15:37:31 +0000 (UTC) From: Jeff Moyer To: "Fabio M. De Francesco" Cc: Alexander Viro , Benjamin LaHaise , linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, linux-kernel@vger.kernel.org, "Venkataramanan\, Anirudh" , Ira Weiny Subject: Re: [RESEND PATCH] fs/aio: Replace kmap{,_atomic}() with kmap_local_page() References: <20221016150656.5803-1-fmdefrancesco@gmail.com> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 Date: Wed, 19 Oct 2022 11:41:21 -0400 In-Reply-To: <20221016150656.5803-1-fmdefrancesco@gmail.com> (Fabio M. De Francesco's message of "Sun, 16 Oct 2022 17:06:56 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org "Fabio M. De Francesco" writes: > The use of kmap() and kmap_atomic() are being deprecated in favor of > kmap_local_page(). > > There are two main problems with kmap(): (1) It comes with an overhead as > the mapping space is restricted and protected by a global lock for > synchronization and (2) it also requires global TLB invalidation when the > kmap=E2=80=99s pool wraps and it might block when the mapping space is fu= lly > utilized until a slot becomes available. > > With kmap_local_page() the mappings are per thread, CPU local, can take > page faults, and can be called from any context (including interrupts). > It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore, > the tasks can be preempted and, when they are scheduled to run again, the > kernel virtual addresses are restored and still valid. > > Since its use in fs/aio.c is safe everywhere, it should be preferred. That sentence is very ambiguous. I don't know what "its" refers to, and I'm not sure what "safe" means in this context. The patch looks okay to me. Reviewed-by: Jeff Moyer