Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp21365862rwd; Thu, 29 Jun 2023 15:10:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4nCdAInYhwcn7ogNu4WmWhUpqDV+pHS4kJt03uXUs05RYoiIdOy2OStfg5BIjcTy8SolQx X-Received: by 2002:a05:6808:d4e:b0:3a3:6bec:da17 with SMTP id w14-20020a0568080d4e00b003a36becda17mr880584oik.21.1688076656240; Thu, 29 Jun 2023 15:10:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688076656; cv=none; d=google.com; s=arc-20160816; b=YuewpSBLWsYSizCmV7Dm90ryl/K2PhjpMff3R1Q8eqSCRPomg4bCylwrRiOfIDsVfW Y3bDq5huCDKNhE1RsXG4yZxjtPLuzVUD6fGL4L2Jn8fkrGXqM6FpzkMYHaC1rHTu4u5N pxjrYhn9K73ju4AjVemZj3vLBeVB0ToprGifW5+C4skmoZ/hHKHlGuRjilOfqSs276d0 pn/X8L7LwJBQ2fbnJS1fQjETW6vZcv+SteXmKcfuemS3Z6YG1arT9oLKDBs+87M+Oz9G 5VS7yK7Ilncps0a2WeKfHpSxgSuipPrevKINXGLmr4zOwsuFquQ4InuGpUMyg8960tLY H4WA== 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=JLjCoTRJbuen8JADQEFzaEd11cEiRRgjR5JMnKL0+KE=; fh=2/OepbD16sII06AHmQTJgD7xcw2OMNoUEY9t7KuTeGw=; b=Ozp30ivtmCkqAhPJvzkG2NnB6Z9wwQlDYA1aONh5BhdDm2YdXELXAzPk3qVVJHq4wx WQZAxPwAOH7cNs97zooDQZXQr98lNTjJLrWzvGySr/CEk6gCD1tavIyXiw9A4PnC0dF0 +YmNrJVGkUVuvjd+KWUm5+I3jktxmitfCTJerORDAU+u/d5KDvITY7ibK5sEMMUcM9Ir wpBeD3R6lbjMbenI53qvO42ltXnIcZDnZu92xlKaV30cnSeEh6+H4nNUayBGc8otbaY3 QmGLgb6vMDenbsgdUJ+uzOV9Yr8YuOyJ5HqlA2k1uhgT46dlVS4T353LZHbhpv+ZH2Bw Etxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=RKNVi0JK; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k135-20020a62848d000000b006687255a465si10432164pfd.298.2023.06.29.15.10.43; Thu, 29 Jun 2023 15:10:56 -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=fail header.i=@mailo.com header.s=mailo header.b=RKNVi0JK; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231361AbjF2VvA (ORCPT + 99 others); Thu, 29 Jun 2023 17:51:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbjF2Vu6 (ORCPT ); Thu, 29 Jun 2023 17:50:58 -0400 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F2AE30C5 for ; Thu, 29 Jun 2023 14:50:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1688075453; bh=oLlIroBMRDkkKoSKm/jnig64fpkTQsUV8Vs7jXlV6S4=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To; b=RKNVi0JK9yb6y9ikoObZVDdxHNI2S5uutZblCHSGincf4Psj2Ag97vTYB5aVbRMcc UrrHBFMqhOnr34uVCquYANjyCyOuq2cOBJitjHzlTIduyd8E1sd62ksQ/gDaTJBvC/ PNM1qd/6Uo+B49nl1VgykaL04dtw4uwhJhusDBCY= Received: by b221-6.in.mailobj.net [192.168.90.26] with ESMTP via ip-20.mailobj.net [213.182.54.20] Thu, 29 Jun 2023 23:50:53 +0200 (CEST) X-EA-Auth: ZFhqXnP7AsOSoIr/Ef0GqN9/yMiSC8/ZRNPogc47fkLBPnGNkvMpik0u2PJ2NVJJPLCdjVVzGTceRqslXnom3aOt+GdSlj3f Date: Fri, 30 Jun 2023 03:20:43 +0530 From: Deepak R Varma To: Bob Peterson , Andreas Gruenbacher , cluster-devel@redhat.com, linux-kernel@vger.kernel.org Cc: Ira Weiny , "Fabio M. De Francesco" , Sumitra Sharma , Deepak R Varma Subject: [PATCH v3 3/6] gfs2: Replace kmap() by kmap_local_page() in gfs2_unstuffer_page Message-ID: <063721a02d5e226d1e9e9782f76ce94c16d73e93.1688073459.git.drv@mailo.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 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. Therefore, replace kmap() with kmap_local_page() in gfs2_unstuffer_page(). Suggested-by: Fabio M. De Francesco Signed-off-by: Deepak R Varma --- Changes in v3: - Patch included in the patch series Changes in v2: - None fs/gfs2/bmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 8d611fbcf0bd..6b850e2ba5c8 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -58,12 +58,12 @@ static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh, struct inode *inode = &ip->i_inode; if (!PageUptodate(page)) { - void *kaddr = kmap(page); + void *kaddr = kmap_local_page(page); u64 dsize = i_size_read(inode); memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize); memset(kaddr + dsize, 0, PAGE_SIZE - dsize); - kunmap(page); + kunmap_local(kaddr); SetPageUptodate(page); } -- 2.34.1