public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Bob Peterson <rpeterso@redhat.com>,
	Andreas Gruenbacher <agruenba@redhat.com>,
	cluster-devel@redhat.com, linux-kernel@vger.kernel.org,
	Deepak R Varma <drv@mailo.com>
Cc: Ira Weiny <ira.weiny@intel.com>,
	Sumitra Sharma <sumitraartsy@gmail.com>,
	Deepak R Varma <drv@mailo.com>
Subject: Re: [PATCH v3 4/6] gfs2: Replace kmap_atomic() by kmap_local_page() in lops.c
Date: Sat, 01 Jul 2023 15:16:48 +0200	[thread overview]
Message-ID: <5948996.alqRGMn8q6@suse> (raw)
In-Reply-To: <4817527acb9e015b3c6929517993ea50ba3427ad.1688073459.git.drv@mailo.com>

On giovedì 29 giugno 2023 23:51:17 CEST Deepak R Varma wrote:
> kmap_atomic() is deprecated in favor of kmap_local_{folio,page}().

Deepak,

Can you please add a reference to the highmem documentation and to the patch 
from Ira that added a deprecation check for kmap() and kmap_atomic() in his 
commit regarding checkpatch.pl?

There may be maintainers / reviewers who are still unaware of this 
information. It would surely help them with reviewing. Furthermore it might 
suggest maintainers to convert their subsystem / driver to the new API or 
remove and use plain page_address() (if it is possible to prove that pages 
can't come from ZONE_HIGHMEM).

> 
> 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 <fmdefrancesco@gmail.com>
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
> 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;
>
Deepak,

Are we mixing declarations with functions calls? Is it good practice? If not, 
I'd suggest to move the mapping to a better suited place.
> 
> @@ -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);
>
Deepak,

How about memcpy_from_page()?

Thanks,

Fabio
>
> -				kunmap_atomic(kaddr);
> +				kunmap_local(kaddr);
>  				*(__be32 *)ptr = 0;
>  				clear_buffer_escaped(bd2->bd_bh);
>  				unlock_buffer(bd2->bd_bh);
> --
> 2.34.1





  reply	other threads:[~2023-07-01 13:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29 21:48 [PATCH v3 0/6] gfs2: kmap{_atomic} conversion to kmap_local_{page/folio} Deepak R Varma
2023-06-29 21:49 ` [PATCH v3 1/6] gfs2: Replace kmap_atomic() by kmap_local_page() in stuffed_readpage Deepak R Varma
2023-07-01 11:02   ` Fabio M. De Francesco
2023-06-29 21:50 ` [PATCH v3 2/6] gfs2: Replace kmap_atomic()+memcpy by memcpy_from_page() Deepak R Varma
2023-07-01 11:17   ` Fabio M. De Francesco
2023-06-29 21:50 ` [PATCH v3 3/6] gfs2: Replace kmap() by kmap_local_page() in gfs2_unstuffer_page Deepak R Varma
2023-07-01 13:01   ` Fabio M. De Francesco
2023-06-29 21:51 ` [PATCH v3 4/6] gfs2: Replace kmap_atomic() by kmap_local_page() in lops.c Deepak R Varma
2023-07-01 13:16   ` Fabio M. De Francesco [this message]
2023-06-29 21:51 ` [PATCH v3 5/6] gfs2: Replace kmap() by kmap_local_page() in gfs2_read_super Deepak R Varma
2023-07-01 13:45   ` Fabio M. De Francesco
2023-06-29 21:52 ` [PATCH v3 6/6] gfs2: Replace kmap_atomic() by kmap_local_page() in gfs2_write_buf_to_page Deepak R Varma
2023-07-01 13:54   ` Fabio M. De Francesco
2023-08-10 15:28     ` Deepak R Varma
2023-07-03  9:17 ` [PATCH v3 0/6] gfs2: kmap{_atomic} conversion to kmap_local_{page/folio} Andreas Gruenbacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5948996.alqRGMn8q6@suse \
    --to=fmdefrancesco@gmail.com \
    --cc=agruenba@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=drv@mailo.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpeterso@redhat.com \
    --cc=sumitraartsy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox