Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp4042779rwi; Mon, 17 Oct 2022 00:06:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4AXFnwyASiJW4Pzh9A8cpcrJwZpmvq34MrAYx57tDr3H1k4OoH9Ckiv7V1su1qbb0QGu2j X-Received: by 2002:a17:902:e845:b0:184:8078:be88 with SMTP id t5-20020a170902e84500b001848078be88mr10578319plg.99.1665990415834; Mon, 17 Oct 2022 00:06:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665990415; cv=none; d=google.com; s=arc-20160816; b=ezNVz6lyXwu4ecMEgcSikjmuJo/cLKEK72j6rpOSHHYv9Kzn05T4j17/B9tSxGyZpn WJ/rZBC3qNg0vFeM4DPsi6qWHk/FU19yOjlHShr8wIupG9gcW2X7/OG2SYi7PgMh4ici GmzZaSLTivQeAUJ+1cc+7kcYrjGkXvyj8hA12rOt+jpEuMfsfv+T3yMNVTMd6IWABkob QaRpiL7HAQSoTpgRdMTyc1vRjI64J4JzbDCkNy4QvU9T4ttFJyeOcbdaVHI3zxwDSBM6 OmSyZ0ErsRWCcMBaSfpxLWSFta1aTV1IkKpbEKqNjnn0zAMh1LtcR7SlSigESwWcPvPF lk0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=e6MH3dloZPv8V8tmHyGC39LCojV1lesAAP3+V/HvbUM=; b=ksdEKPrHd4xAN0BRkAjL1V7MxHbCg2Y2d+AzWuBKAJkT0kgk/+7dxAv9P++25Qq2NR Fr3fXMqCtvSNtSDE9mbOkxRhC77Y4wg0+i/LfSSHQXX8tDFFmvRdZzEaImMz6UhMgv70 l3YZTGSQLhRO0UjKotwyku9NYQfBcBTMQ2VsxwVRHu+M5GHfECxnqG/QfEK9C/hp8Ltd FZ8gZz6CYBKJ0PlevaAcCqNog1InFV0fsxQ2m/oBzhxZ5BNPDf/nRClSKbVfdQG09QrJ R64a3KoRSgjU+Cl4W89wcegWDc84gdcgLGEc0rodnNA1SEyyRrAKzWJ0y45DiSBIW13X 0A1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GgqfhjAY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b9-20020a63eb49000000b00460a6ee5b53si12193796pgk.37.2022.10.17.00.06.43; Mon, 17 Oct 2022 00:06:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GgqfhjAY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230024AbiJQGfx (ORCPT + 99 others); Mon, 17 Oct 2022 02:35:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230004AbiJQGfv (ORCPT ); Mon, 17 Oct 2022 02:35:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42D3A4B9BB; Sun, 16 Oct 2022 23:35:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E1FA9B80E48; Mon, 17 Oct 2022 06:35:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE300C433C1; Mon, 17 Oct 2022 06:35:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665988547; bh=rZyWQiABeLWts3jlfUmft7CVgttT6trUfj+DCShdiW0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GgqfhjAYH9VH+0LjV8q9VyWThIj+LmVg0rc7d+e6qfph2lE5FBmDea81WiKwF0/UJ ybRwCPm8qBK3ZlGFqCzODxFGjKFSU4fDc9HLZronmDDnJnFyVPMc5ex1nd1HZDwoDu wUPgkZx06wc8nuXCdvyEYOBkLMEIl8QAwc+s47GU+EIf5kcA+iZFGajXO7NjC+oFqs 8UfnUN6fIArk1izpQr1/eSEENeOM6zJyoKq9BnJjYW1ExhszKqcBPxl4OXpthvVtAy YkHfGYTEGuD7OuJvdP819esLOdWhmujJD5wq1Jj3yiyp18zlw55qEb/xng/VzFlk5g AChZhbY5ay+Yg== Date: Mon, 17 Oct 2022 08:35:42 +0200 From: Christian Brauner To: "Fabio M. De Francesco" , H@wittgenstein Cc: Nicolas Pitre , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, "Venkataramanan, Anirudh" , Ira Weiny Subject: Re: [PATCH] fs/cramfs: Convert kmap() to kmap_local_data() Message-ID: <20221017063542.bj7aqcxjfzd5l4da@wittgenstein> References: <20221012091356.16632-1-fmdefrancesco@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20221012091356.16632-1-fmdefrancesco@gmail.com> X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 12, 2022 at 11:13:56AM +0200, Fabio M. De Francesco wrote: > The use of kmap() is 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’s pool wraps and it might block when the mapping space is fully > 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/cramfs is safe everywhere, it should be preferred. > > Therefore, replace kmap() with kmap_local_page() in fs/cramfs. Instead > of open-coding kmap_local_page() + memcpy(), use memcpy_from_page(). > > Cc: "Venkataramanan, Anirudh" > Suggested-by: Ira Weiny > Signed-off-by: Fabio M. De Francesco > --- Looks good to me, Reviewed-by: Christian Brauner (Microsoft)