From patchwork Thu Jun 29 21:49:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 114457 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9944257vqr; Thu, 29 Jun 2023 15:11:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7kRy+Tjq57rS1PzYEa8NnkirPyX6JPTlT3yyI/IZFwRWJ59eB+QwPPJQAvrWBQK6JVr07d X-Received: by 2002:a05:6a20:1586:b0:11f:7829:6d6c with SMTP id h6-20020a056a20158600b0011f78296d6cmr1279729pzj.3.1688076710956; Thu, 29 Jun 2023 15:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688076710; cv=none; d=google.com; s=arc-20160816; b=aeOSodf1Q4Ek82VsdGDKS+m8qoDFiLO7DC287KHwUEm56nnzTAZzELIET4F7FklQ7+ DZfXUyMUJdWLSEuuJlW01JcIkCCRcruSVmBCAhs6xDzQFPqyGY0qKCTidLknHVaYs9kz ur5ZARWM2gy7Jp3ptfKkWjhkp1FdaMjpHxNeGqgh5vvoXXWJ8hI4yG+KAiZoGjVi2upC hFYPdl60/ROJslkmE1AuMDGRjbNRjroj2KfQzXJEBMXyduS6s1YohcQRMZ8/P5lxCjDk pq1E68AF8nSuogoY1nK04B6sr3bNC5keFtDqCNvGyblgrkqiCjzFRAgXbMnnCQSBknjZ NLQQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XHh/jI/bdXc93KNn2kIm/kDXKE1qBvxy+TINr4YmCdA=; fh=2/OepbD16sII06AHmQTJgD7xcw2OMNoUEY9t7KuTeGw=; b=Or6O1APmGI7bHHxm/rC5Sw/6aYEOBnIXdSdOT8U5oh8Wvro5OVz1cEa5Zz50g4I/51 +Ss1Xg4cpP3psvVhbU6ebIHyakwlEXHCOPv9GnHq4SF87lGWavEtf6C4CVFqnq4isX8f Amnp3AWBWmXRfxJ9BVQnrTQTegZrbzIFe7vdKK3/b+wEU52JEj+WKztVp1bl43yfRIzZ abQYCuukShrVg0wyOktTIHWBD/E0yYGAiraWGRo8UNMpC4tF4dfSgzchWOLRu557UOOs Ix2zdsvyMbxHv0RzF766kA7zPK7pXSXQBU3Y/dLzXJSnKSAFA8AzMUPMAX40vzjRj2qy G82g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=k0Fa9zvD; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k9-20020a170902c40900b001afd000029bsi11349078plk.581.2023.06.29.15.11.36; Thu, 29 Jun 2023 15:11:50 -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=k0Fa9zvD; 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 S232095AbjF2Vtx (ORCPT + 99 others); Thu, 29 Jun 2023 17:49:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231787AbjF2Vtq (ORCPT ); Thu, 29 Jun 2023 17:49:46 -0400 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A068530C4 for ; Thu, 29 Jun 2023 14:49:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1688075378; bh=Js+wviSqbRoPvM+R8wP9vofgFSlATI7fQH4Z+TLAhBM=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=k0Fa9zvD/neTdeo9mrtsWdPMl5QyAU47R0HPgkV0n3DfUxzs+HW9bCbv4lnoCY40F er7hsbCoE5Bc+gThNcAGF4dxuvBZu8KLnBmCVsvuJ1JIMe3YJ4eSxIoRcyB4A8cL3m BJTdzrUAxFN56lr07AN7OrVIsIaAxV35ZwLdNjKs= Received: by b221-2.in.mailobj.net [192.168.90.22] with ESMTP via ip-20.mailobj.net [213.182.54.20] Thu, 29 Jun 2023 23:49:38 +0200 (CEST) X-EA-Auth: bfXx7m6mBHf0bbbEInyNo09c2pO3FAllciMTjbbMOaPyxDfwVkN/aN/2e4+nmIyLXNLywzBzQgffhdOIJnAiNivQauo1214l Date: Fri, 30 Jun 2023 03:19:29 +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 1/6] gfs2: Replace kmap_atomic() by kmap_local_page() in stuffed_readpage Message-ID: <1955d9c440240f4c97efd80f3efca550871fe0ef.1688073459.git.drv@mailo.com> References: MIME-Version: 1.0 Content-Disposition: inline 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770076725375224913?= X-GMAIL-MSGID: =?utf-8?q?1770076725375224913?= kmap_atomic() is deprecated in favor of kmap_local_{folio,page}(). Therefore, replace kmap_atomic() with kmap_local_page() in stuffed_readpage(). kmap_atomic() disables page-faults and preemption (the latter only for !PREEMPT_RT kernels), However, the code within the mapping/un-mapping in stuffed_readpage() does not depend on the above-mentioned side effects. Therefore, a mere replacement of the old API with the new one is all that is required (i.e., there is no need to explicitly add any calls to pagefault_disable() and/or preempt_disable()). Suggested-by: Fabio M. De Francesco Signed-off-by: Deepak R Varma Reviewed-by: Fabio M. De Francesco --- Changes in v3: - split into 2 patches - included in the patch set. Was sent as standalone patch previously Changes in v2: - Update patch description to correct the replacement function name from kmap_local_page to kmap_local_folio fs/gfs2/aops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index 3b41542d6697..3eac4f2f5c27 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c @@ -432,10 +432,10 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) if (error) return error; - kaddr = kmap_atomic(page); + kaddr = kmap_local_page(page); memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize); memset(kaddr + dsize, 0, PAGE_SIZE - dsize); - kunmap_atomic(kaddr); + kunmap_local(kaddr); flush_dcache_page(page); brelse(dibh); SetPageUptodate(page); From patchwork Thu Jun 29 21:50:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 114458 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9944283vqr; Thu, 29 Jun 2023 15:11:54 -0700 (PDT) X-Google-Smtp-Source: APBJJlFgvTRGP5dv3L0EFJiaNA8DgYmBifzmmj1VzwBH2uq9dtMTwDNAC/GChygL7xGk0spt7RO+ X-Received: by 2002:a05:6e02:164c:b0:340:ae63:38a4 with SMTP id v12-20020a056e02164c00b00340ae6338a4mr549238ilu.2.1688076713878; Thu, 29 Jun 2023 15:11:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688076713; cv=none; d=google.com; s=arc-20160816; b=fQqImOi6yIE9bwM624/TXtT3vdBXN1qYyHbPsL98JDxdnotmOaH7bVcHvotjtHmU6M JN4at2iE888SyannbF8UXLC5lbCYkvOh6RtgMBKlX5Jr8hSSgbVgZ21uXh8ndXM+KEsZ aRuHkGObOMI6FdfRVavm6h9xPNxTm676HZ+hAoIwAvE99wu37WF5XDjHTMQoad3Mvd/G lNeazS3qBPlwqi8GythSUWElUpe1nAlplKzRyYqPeXQNZ5svAqTHOGshY2IzTNoX4UEE IaszE757BAPEiZonnoHMQ4Sl/+rLV5W6st9ebY1EEPviCYI3z0vh0Q+9LeQaQfrV2yhW sDsQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UpLlHUWZXL87rYGugpIj04FqgAB+oKEsvUu+Ka67nCE=; fh=2/OepbD16sII06AHmQTJgD7xcw2OMNoUEY9t7KuTeGw=; b=gQ+vitCxOma0o7GwHQ5UsZTwGUoW6JfypihYMNRDM5c976uXAOZnBs/mCU9/Gvju7w h4sA9EFuoeRzMWiTEM+lAtwEtqGbd0QrYHea9mY2Y5Hr8XjyAXKELEjpSs2KKoJYagqN Wkc2fXe2MEn340lPRfMefqyS4d22mhORizcCSehjiN16tN8w5EL3QFKrW3AdD/ZDBsh0 sCbo6t1ZOx8IZWA3gRGZO1v1XlCnBkHqIE3R8Z/367k6MYSqpW5kS7py2LIWyK05Fj2l lI8JNTwGkSv/tRCRxZ399x0/DEsDKwaurNGaqokxwlR8CoYyGVAU92RTtFRNTm8xxG4x c0ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=Y2Y80Hzd; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j192-20020a638bc9000000b00542b1792242si11322780pge.720.2023.06.29.15.11.39; Thu, 29 Jun 2023 15:11:53 -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=Y2Y80Hzd; 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 S229668AbjF2VuY (ORCPT + 99 others); Thu, 29 Jun 2023 17:50:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230333AbjF2VuW (ORCPT ); Thu, 29 Jun 2023 17:50:22 -0400 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19C2530EC for ; Thu, 29 Jun 2023 14:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1688075416; bh=x7zd5uVxyeDRl54E+RTPj06ix1hRuqdAnUwSzOvgF+8=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=Y2Y80HzdbqBIq3756vJTl6ufeFaY0ZCXI1TkJovWlAK94g55+ZynJfooM/S2vE0zN 92Vlg8l+PHyjD89HEQTr1ND9SWZ+EOPuE6vWrLzfdn4IAPpjOBZSbQIYie4KZcR1Yy qL/OG7LlBUiH5LmWx6bWQoIAXmMPIMio5T9yu7JE= Received: by b221-3.in.mailobj.net [192.168.90.23] with ESMTP via ip-20.mailobj.net [213.182.54.20] Thu, 29 Jun 2023 23:50:16 +0200 (CEST) X-EA-Auth: 8qhRdke3mHv05h5eyYsrMODcCW4Qllf4hyhJ119mGTYvfLGar6Bbd79n7KIGsdADT98DNArOr+XjY8Xfvucm8mUPvSIQ7zbX Date: Fri, 30 Jun 2023 03:20:07 +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 2/6] gfs2: Replace kmap_atomic()+memcpy by memcpy_from_page() Message-ID: <4d132d7aa9cc71f88e6e02c8f6fcb0fec56542aa.1688073459.git.drv@mailo.com> References: MIME-Version: 1.0 Content-Disposition: inline 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770076728219159616?= X-GMAIL-MSGID: =?utf-8?q?1770076728219159616?= kmap_atomic() is deprecated in favor of kmap_local_{folio,page}(). kmap_atomic() disables page-faults and preemption (the latter only for !PREEMPT_RT kernels), However, the code within the mapping/un-mapping in gfs2_internal_read() does not depend on the above-mentioned side effects. Further, memcpy_{from,to}_page() wrappers combine the {kmap, unmap}_local_page() blocks when they are intended exclusively to copy contents from/to the temporary mapped page. So, replace the kmap_atomic()/kunmap_automic() block by the memcpy_from_page() API call. This change allows to tidy-up code and also eliminate unused variable p. Suggested-by: Fabio M. De Francesco Signed-off-by: Deepak R Varma --- Changes in v3: - Split as a separate patch for conversion in gfs2_internal_read() - Use memcpy_from_page() as suggested by Fabio and Andreas G - Included split version in patch set Changes in v2: - Update patch description to correct the replacement function name from kmap_local_folio to kmap_local _page fs/gfs2/aops.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index 3eac4f2f5c27..f47fed657763 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c @@ -489,7 +489,6 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *buf, loff_t *pos, unsigned copied = 0; unsigned amt; struct page *page; - void *p; do { page = read_cache_page(mapping, index, gfs2_read_folio, NULL); @@ -498,12 +497,12 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *buf, loff_t *pos, continue; return PTR_ERR(page); } - p = kmap_atomic(page); - amt = size - copied; if (offset + size > PAGE_SIZE) amt = PAGE_SIZE - offset; - memcpy(buf + copied, p + offset, amt); - kunmap_atomic(p); + else + amt = size - copied; + + memcpy_from_page(buf, page, offset, amt); put_page(page); copied += amt; index++; From patchwork Thu Jun 29 21:50:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 114459 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9944537vqr; Thu, 29 Jun 2023 15:12:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlHvm2NjCAqUc9LewzPpXkve3l2mPO5l5GpabjMqvjzolup2drNM6KPhkE2mY0cfDGRV5OhS X-Received: by 2002:a17:902:7611:b0:1b8:2ba0:c9a8 with SMTP id k17-20020a170902761100b001b82ba0c9a8mr529128pll.2.1688076745726; Thu, 29 Jun 2023 15:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688076745; cv=none; d=google.com; s=arc-20160816; b=k5/KVN0uCNPFPaVNAdf00FJg5dNPovbBGtlhobKas7j1jzUJSL0xEUo+PnPThj+8SI yg39FIGAnCb2dWqZXjix3YPZyRCMHdIDOtIqj2WKGdP9p+Z5FfcZMa/UMyOUtfv0TjuM 0Qn6UookgvVBUGDobx/vMGnOWG6DE1yFCWSGIl7k+jXqiu0yF1fNeJYz3cNxwpHQ75zD GnAO94mqCPamy9N91q4MD1sIoUnyePjl2oDmu3u48KGhnYRFZf8Nz3bUklvPkmC17IWU LwsZoVak+7IH+mHxfM0e0GcvNRPViGWySBYHe5r3PANHOAZjk9pqApy1VptRfacJpdYW tJgw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k9-20020a170902c40900b001afd000029bsi11349078plk.581.2023.06.29.15.12.12; Thu, 29 Jun 2023 15:12:25 -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 S231839AbjF2VvA (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-Disposition: inline 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770076761198564208?= X-GMAIL-MSGID: =?utf-8?q?1770076761198564208?= 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); } From patchwork Thu Jun 29 21:51:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 114453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9943399vqr; Thu, 29 Jun 2023 15:10:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7hoKwuqMQNukG9hxd9fSKmV5FffsfpRrv20Mk1lqykaHOw09CyLlAv40rcmMHcr7bZaIA+ X-Received: by 2002:aca:e109:0:b0:3a1:d4c4:ac4b with SMTP id y9-20020acae109000000b003a1d4c4ac4bmr628473oig.3.1688076619656; Thu, 29 Jun 2023 15:10:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688076619; cv=none; d=google.com; s=arc-20160816; b=hVvfEPq0qp7wFaubBKm2Bz2xZrQbQaQ7RGPfsTdJmU1/fQj5oBK9uFD8AFbFmT13ep WkyS68RMcrIZs4KfeKnhft4ELbr0Uv3P3mIpzPeSjq5sLyBRsaOv0QHzgj8TahqJiEjN joMTaHKX2pPzjYoi7B9b7SCmfrbeMnnUxL099EDJ5QGIrlej7OT8oeKXb/N4BLoZ+T3+ wVJsZy9KECSKf62J3hddc/1mprK6VbNK7ZpamxnjaXsLPdHNqCeHJGCFZfDWIVbo38NI 906l5XFGxkr53uznYqUqbFx1l1At+PIGxKyRBX2S9QLHE+IRr/LGhutyYToQjKO+kA63 w3Ow== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=VqAL1afVs3VwQQxoVXsOQ91yHzULT56tCGgI4gabYgw=; fh=2/OepbD16sII06AHmQTJgD7xcw2OMNoUEY9t7KuTeGw=; b=U344dhGHyPOSRgafCdWXdAzIcTTcWi94mf9CGMKVBboFR88S5eNkKyWmClosiUNQg+ J2TDp8DTxaMNx8FrL9p6Gn0QjH2y0ZYcF5gDoIlL683vOlt9E7stllW52D3ofmUOB5IA 7YR4IG/RPMwHSIGjXpUNU3S2O1ruJwUiNZoVuc/4MJVoQFlHVEy4iQ9+Oow9m2DqMD85 1xvyssewxAIltoU5/WhJXFSWIcd9C9gqpRxU6bFy2takR758zBxj2EEBJ+0vIH+oQZdm iNt8zwFCqIJvoZJdpsWZ8aJFBDGzV63JRKmAiWxDb/MnLQuaQvrdSl6bJ/4wIcmWlXZt Dn0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=QMyCcPAU; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z16-20020a656650000000b005574bf28174si11316901pgv.491.2023.06.29.15.10.03; Thu, 29 Jun 2023 15:10:19 -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=QMyCcPAU; 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 S231653AbjF2Vve (ORCPT + 99 others); Thu, 29 Jun 2023 17:51:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbjF2Vvc (ORCPT ); Thu, 29 Jun 2023 17:51:32 -0400 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7180730D1 for ; Thu, 29 Jun 2023 14:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1688075487; bh=C7lSYHOPm/Z4sI0GQts4IYgG0YiR3DHTQkmvN2BfzJ4=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=QMyCcPAU/yNJ7M8ZoRbSzy+TrDT7NltcM2XbOYbAuqoUHgof5TyMaFqFkhP+XrsxV 4OamwRXXx4SMlX+QsORhYPxfNVfIbf5ZKOF2GrnCVzzH5RFoG+qCaNqj4Il/RC1s3d 3oGZ3w/Cqg8MdcOw68SSXakl6nPfeZUkYxtaExvU= Received: by b221-1.in.mailobj.net [192.168.90.21] with ESMTP via ip-20.mailobj.net [213.182.54.20] Thu, 29 Jun 2023 23:51:27 +0200 (CEST) X-EA-Auth: P5HCG1ciElwbYgm7onYtMKqytCsT9R2NvTWwxi5496GTptuJln+k/TlBbmf/Liqh+qR0xtiWqaFWGGY8kby6/5SK7yiAPc69 Date: Fri, 30 Jun 2023 03:21:17 +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 4/6] gfs2: Replace kmap_atomic() by kmap_local_page() in lops.c Message-ID: <4817527acb9e015b3c6929517993ea50ba3427ad.1688073459.git.drv@mailo.com> References: MIME-Version: 1.0 Content-Disposition: inline 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770076629241577581?= X-GMAIL-MSGID: =?utf-8?q?1770076629241577581?= kmap_atomic() is deprecated in favor of kmap_local_{folio,page}(). Therefore, replace kmap_atomic() with kmap_local_page() in following functions of lops.c: - gfs2_jhead_pg_srch() - gfs2_check_magic() - gfs2_before_commit() kmap_atomic() disables page-faults and preemption (the latter only for !PREEMPT_RT kernels), However, the code within the mapping/un-mapping in stuffed_readpage() does not depend on the above-mentioned side effects. Therefore, a mere replacement of the old API with the new one is all that is required (i.e., there is no need to explicitly add any calls to pagefault_disable() and/or preempt_disable()). Suggested-by: Fabio M. De Francesco Signed-off-by: Deepak R Varma --- Changes in v3: - Patch included in patch series Changes in v2: - None fs/gfs2/lops.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 1902413d5d12..a7c2296cb3c6 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c @@ -427,7 +427,7 @@ static bool gfs2_jhead_pg_srch(struct gfs2_jdesc *jd, { struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); struct gfs2_log_header_host lh; - void *kaddr = kmap_atomic(page); + void *kaddr = kmap_local_page(page); unsigned int offset; bool ret = false; @@ -441,7 +441,7 @@ static bool gfs2_jhead_pg_srch(struct gfs2_jdesc *jd, } } } - kunmap_atomic(kaddr); + kunmap_local(kaddr); return ret; } @@ -626,11 +626,11 @@ static void gfs2_check_magic(struct buffer_head *bh) __be32 *ptr; clear_buffer_escaped(bh); - kaddr = kmap_atomic(bh->b_page); + kaddr = kmap_local_page(bh->b_page); ptr = kaddr + bh_offset(bh); if (*ptr == cpu_to_be32(GFS2_MAGIC)) set_buffer_escaped(bh); - kunmap_atomic(kaddr); + kunmap_local(kaddr); } static int blocknr_cmp(void *priv, const struct list_head *a, @@ -699,10 +699,10 @@ static void gfs2_before_commit(struct gfs2_sbd *sdp, unsigned int limit, void *kaddr; page = mempool_alloc(gfs2_page_pool, GFP_NOIO); ptr = page_address(page); - kaddr = kmap_atomic(bd2->bd_bh->b_page); + kaddr = kmap_local_page(bd2->bd_bh->b_page); memcpy(ptr, kaddr + bh_offset(bd2->bd_bh), bd2->bd_bh->b_size); - kunmap_atomic(kaddr); + kunmap_local(kaddr); *(__be32 *)ptr = 0; clear_buffer_escaped(bd2->bd_bh); unlock_buffer(bd2->bd_bh); From patchwork Thu Jun 29 21:51:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 114455 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9943647vqr; Thu, 29 Jun 2023 15:10:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4linuDS6HyNk5FCXVSw2DVvA6F0vBznwwfh6+DQ3B2gOPEiCQ6KI0ia45wSJXCHd3vvCX+ X-Received: by 2002:a05:6a20:3d1a:b0:100:b92b:e8be with SMTP id y26-20020a056a203d1a00b00100b92be8bemr1348545pzi.2.1688076647533; Thu, 29 Jun 2023 15:10:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688076647; cv=none; d=google.com; s=arc-20160816; b=iJjsMvfhk3e2wc5ryDT8u+fZpSfl+Zz1+3IYfDIUt8F/6yEauaHiCPXGaHuxkM3Xlr Da3juGX06bn8jsn0Pukf4jC/xvNoE63VEweoql4WIxn5U57Oj4RvJgaWL/6bLsPYzqY9 OZaZCNpmozlQqXsELtdp1MQUF0KXvwUxjS6vZkU691/RBrti3YBlelrIq4efkyTfPIlN 9/fFUzQSlN97BofWTStGlTI9xSWLaaTHd9LikMUWEPquxSVd46dm6i3JK7aL50tDLgUC zeLk9kNwW5FYtQ0BRom6y0UFD8yMaRRRFYlgvW1Gf/R/Uu/lbWyADnsnyjCobVrJzm1v bNuQ== 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=6UCUjbfrjCRlXH9VZi7fTsH4/KP0Y6Q0yvhS5S25id8=; fh=2/OepbD16sII06AHmQTJgD7xcw2OMNoUEY9t7KuTeGw=; b=VuuXylBgYpE9u1BLcwzTegfVgghNnevvpKkn2e5HL2hUC7WvMF+w4iUV0e2SX1MaqS REqv7BJIlntaIcsmRPh0vSMxckchA9V/p6SbwI0LVBCBrW7FlSe4YK7nqfDPHdXDC/j9 Irf24c5YdjeZ5aZhfiPr0lMSw6z5T+M23lXhqP7+G1fBtMSE7qy4YCYH5xFskLoe0ZxB HUqe8PB8gJc+mDJIdBryP5wOw81lUlO8eq/yefbeqGxHJH/9jEUw1r0sHraPsQzerwsB yUfLkq28cM0KpwcSEkX+dADxC0vR3Qv2GB0WkzIFEo38BwGy3VL2+pmrT/CfVG3wHTeA l3/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=XRJ6RXTG; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z16-20020a656650000000b005574bf28174si11316901pgv.491.2023.06.29.15.10.34; Thu, 29 Jun 2023 15:10:47 -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=XRJ6RXTG; 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 S232011AbjF2VwJ (ORCPT + 99 others); Thu, 29 Jun 2023 17:52:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231981AbjF2VwH (ORCPT ); Thu, 29 Jun 2023 17:52:07 -0400 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBE4D30D1 for ; Thu, 29 Jun 2023 14:52:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1688075522; bh=zk8RNtYdPSPBv7E+7W/pedrI7qf8NuNNmYmsN5VZIDs=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To; b=XRJ6RXTGWMzmNmFQPq6/3+6nTNCsgdDbGCtgIUBkpBLTTHSPoohOMaJwJ2j5xRlFp wJ5Vde45Sx+Jf2LjWEssmIj/ALt7Ks1UuCaoC8ebXUreJZPe2FXRYVnkFcO4CirQIQ mI7ftE1KkbmoXHL8hjukzCbjA8jyQHdAg9Brlsf8= Received: by b221-5.in.mailobj.net [192.168.90.25] with ESMTP via ip-20.mailobj.net [213.182.54.20] Thu, 29 Jun 2023 23:52:02 +0200 (CEST) X-EA-Auth: IotyenF4/umU0ZnNEfNRYcA4iNvIyKfnNgylSBABxKCWziWNjq5HJWJd2DAbytP60ExoGcmb2zoNuRUeth0oMxjaLd/N/tX+ Date: Fri, 30 Jun 2023 03:21:53 +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 5/6] gfs2: Replace kmap() by kmap_local_page() in gfs2_read_super Message-ID: <7ad72f9d1a97d673483c206d8ac9a88f2e32d3b9.1688073459.git.drv@mailo.com> References: MIME-Version: 1.0 Content-Disposition: inline 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770076659024278645?= X-GMAIL-MSGID: =?utf-8?q?1770076659024278645?= 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_read_super(). Suggested-by: Fabio M. De Francesco Signed-off-by: Deepak R Varma --- Changes in v3: - Patch included in patch set Changes in v2: - None fs/gfs2/ops_fstype.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 8a27957dbfee..80fe61662412 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -264,9 +264,9 @@ static int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector, int silent) __free_page(page); return -EIO; } - p = kmap(page); + p = kmap_local_page(page); gfs2_sb_in(sdp, p); - kunmap(page); + kunmap_local(p); __free_page(page); return gfs2_check_sb(sdp, silent); } From patchwork Thu Jun 29 21:52:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 114460 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9944954vqr; Thu, 29 Jun 2023 15:13:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5iH2+S3ZB7TReddR77nUoXwCd/olAxkNcSWUNVAg/YyOjPzsDo508kpri6Ug32FeonLRQt X-Received: by 2002:a05:6a20:8e01:b0:123:149b:a34f with SMTP id y1-20020a056a208e0100b00123149ba34fmr1288628pzj.1.1688076795652; Thu, 29 Jun 2023 15:13:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688076795; cv=none; d=google.com; s=arc-20160816; b=foQScbAbEbmyb4w0+y77ln++dZforcx1Z03oAWN02AXkClL36m3rZ+mSCdeV3R+jqM OJ/2QQBGsJZ+pmq9Z5SjZX3QRRAUjboFDq/51oVgdFelThwHL6EvsHXXgW+ACgoX0kr9 M0xL/rpuHkVuXL3+qkOUospsD1qRSPpQX0P7D3zP3/tIP9jbhd48SajliPkegEUrGKfc CMUT1/FZtJXyU6rUKYZiU8RJXOn0Nie/5M8BTLpbcgA08mAOw1isxMczSSKHb9+lYzUJ QE9P9XwQDns+1mxPJ6czWyufKccoJ/b720zmvm4ttcDf9wPMSg6dz6vyKohNHXSgKDCM LT3A== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Dn4FxUBt1nJ2/5Cw/yPMrck6RPvZ2RavcA0IvoH9SbU=; fh=2/OepbD16sII06AHmQTJgD7xcw2OMNoUEY9t7KuTeGw=; b=zgEB25dXuuKmdjUKuJub86Z7JZfwa3Ep5TwIW3mGn1snPa8c2HNrCrfTBHVSBirqlo joSECAae2Ig9HP+/3UyCWVDVOsUC/HtpH4lMo4O2pfqnkxIJcZjTQ2VKa6ltJY5OeKuF fa/0f83YZsNZBXrkxEVCAWJ+AgDrrQEGP5q7n1nKDWZUOfzABTHJYOzyPgdtjZLypIqi YnbWKs31BtVT/5qXwS8ETATSiyziV6YkmD7pR9OI3ifomjDIyuuiHOvmZ4htOP7ad9tt XAKbalXQtAh6VQaPM9CYOshVsF49eWyQF8dQiNvWcV33iJyTP1Pz5Z7mfiNsnc/auPKx M7jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=jROdF5sK; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z16-20020a656650000000b005574bf28174si11316901pgv.491.2023.06.29.15.13.02; Thu, 29 Jun 2023 15:13:15 -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=jROdF5sK; 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 S232139AbjF2Vwn (ORCPT + 99 others); Thu, 29 Jun 2023 17:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232125AbjF2Vwl (ORCPT ); Thu, 29 Jun 2023 17:52:41 -0400 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB41D30C4 for ; Thu, 29 Jun 2023 14:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1688075556; bh=UA/oPXEOCkpLvdvEKZfva8LkSO3tk7fFipNWehdBuOA=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=jROdF5sKV/UphvUFU2txfGwyrTjsaRUbPT4TQa58ZW19BxibusSFDDztO1qgzlsyA YcyR1gW1BBlDJgqCWuGxBDr2NTTWyZzc2XsAmJG8/Le2odaW5y/ufJi8wq2+CGdl5Y f6AbJ5dIIJ7cUFUEqV8whZmHs2ch3/yWwjoVoT8E= Received: by b221-2.in.mailobj.net [192.168.90.22] with ESMTP via ip-20.mailobj.net [213.182.54.20] Thu, 29 Jun 2023 23:52:36 +0200 (CEST) X-EA-Auth: Rz1yyKWhBlZLKK+E7BgmFVdgRQu2DOQ6nBvjfd3qC+VEec0HVUJnMCWv71/GeS1XHqO4oOENrwt389pQ/71L0tyeKcGUbMkM Date: Fri, 30 Jun 2023 03:22:27 +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 6/6] gfs2: Replace kmap_atomic() by kmap_local_page() in gfs2_write_buf_to_page Message-ID: <4bed561513ba76486ea3fc87f97e6c646f98cbe7.1688073459.git.drv@mailo.com> References: MIME-Version: 1.0 Content-Disposition: inline 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770076814210199230?= X-GMAIL-MSGID: =?utf-8?q?1770076814210199230?= kmap_atomic() is deprecated in favor of kmap_local_{folio,page}(). Therefore, replace kmap_atomic() with kmap_local_page() in gfs2_write_buf_to_page(). kmap_atomic() disables page-faults and preemption (the latter only for !PREEMPT_RT kernels), However, the code within the mapping/un-mapping in gfs2_write_buf_to_page() does not depend on the above-mentioned side effects. Therefore, a mere replacement of the old API with the new one is all that is required (i.e., there is no need to explicitly add any calls to pagefault_disable() and/or preempt_disable()). Suggested-by: Fabio M. De Francesco Signed-off-by: Deepak R Varma --- Changes in v3: - Patch included in patch set Changes in v2: - None fs/gfs2/quota.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 386ca770ce2e..e5767133aeea 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -764,10 +764,10 @@ static int gfs2_write_buf_to_page(struct gfs2_inode *ip, unsigned long index, } /* Write to the page, now that we have setup the buffer(s) */ - kaddr = kmap_atomic(page); + kaddr = kmap_local_page(page); memcpy(kaddr + off, buf, bytes); flush_dcache_page(page); - kunmap_atomic(kaddr); + kunmap_local(kaddr); unlock_page(page); put_page(page);