linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] fuse: Use kmap_local_page()
       [not found] <CAPm50aLNUNGo94u1yVKSJwy3rehRP84ha8YmbOdMyehFeVah0w@mail.gmail.com>
@ 2021-08-17 15:41 ` Miklos Szeredi
  2021-08-20  1:48   ` Hao Peng
       [not found]   ` <CAPm50aLXQC_Q+fEPsJaUJjn7ahHV57FM1vCOVwJpFfnghXXbzw@mail.gmail.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Miklos Szeredi @ 2021-08-17 15:41 UTC (permalink / raw)
  To: Hao Peng; +Cc: linux-fsdevel

On Tue, 17 Aug 2021 at 05:17, Hao Peng <flyingpenghao@gmail.com> wrote:
>
> kmap_local_page() is enough.

This explanation is not enough for me to understand the patch.  Please
describe in more detail.

Thanks,
Miklos

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fuse: Use kmap_local_page()
  2021-08-17 15:41 ` [PATCH] fuse: Use kmap_local_page() Miklos Szeredi
@ 2021-08-20  1:48   ` Hao Peng
       [not found]   ` <CAPm50aLXQC_Q+fEPsJaUJjn7ahHV57FM1vCOVwJpFfnghXXbzw@mail.gmail.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Hao Peng @ 2021-08-20  1:48 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel

>On Tue, Aug 17, 2021 at 11:42 PM Miklos Szeredi <miklos@szeredi.hu> wrote:
>
> On Tue, 17 Aug 2021 at 05:17, Hao Peng <flyingpenghao@gmail.com> wrote:
> >
> > kmap_local_page() is enough.
>
> This explanation is not enough for me to understand the patch.  Please
> describe in more detail.
>
Due to the introduction of kmap_local_*, the storage of slots used for
short-term mapping has
changed from per-CPU to per-thread. kmap_atomic() disable preemption,
while kmap_local_*()
only disable migration.
There is no need to disable preemption in several kamp_atomic places
used in fuse.
The detailed introduction of kmap_local_*d can be found here:
https://lwn.net/Articles/836144/
Thanks.
> Thanks,
> Miklos

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fuse: Use kmap_local_page()
       [not found]   ` <CAPm50aLXQC_Q+fEPsJaUJjn7ahHV57FM1vCOVwJpFfnghXXbzw@mail.gmail.com>
@ 2021-09-07 15:04     ` Miklos Szeredi
  0 siblings, 0 replies; 5+ messages in thread
From: Miklos Szeredi @ 2021-09-07 15:04 UTC (permalink / raw)
  To: Hao Peng; +Cc: linux-fsdevel

On Wed, 18 Aug 2021 at 09:48, Hao Peng <flyingpenghao@gmail.com> wrote:
>
> >On Tue, Aug 17, 2021 at 11:42 PM Miklos Szeredi <miklos@szeredi.hu> wrote:
>>
>> >On Tue, 17 Aug 2021 at 05:17, Hao Peng <flyingpenghao@gmail.com> wrote:
>> >>
>> >> kmap_local_page() is enough.
>>
>> >This explanation is not enough for me to understand the patch.  Please
>> >describe in more detail.
>
>    Due to the introduction of kmap_local_*, the storage of slots used for short-term mapping has
>    changed from per-CPU to per-thread. kmap_atomic() disable preemption, while kmap_local_*()
>    only disable migration.
>    There is no need to disable preemption in several kamp_atomic places used in fuse.
>    The detailed introduction of kmap_local_*d can be found here:
>    https://lwn.net/Articles/836144/


Can you please resubmit the patch with this explanation and without
tab/space corruption?

Thanks,
Miklos

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fuse: Use kmap_local_page()
  2021-09-08  8:38 Peng Hao
@ 2021-09-08  8:56 ` Miklos Szeredi
  0 siblings, 0 replies; 5+ messages in thread
From: Miklos Szeredi @ 2021-09-08  8:56 UTC (permalink / raw)
  To: Peng Hao; +Cc: linux-fsdevel

On Wed, 8 Sept 2021 at 10:38, Peng Hao <flyingpenghao@gmail.com> wrote:
>
> Due to the introduction of kmap_local_*, the storage of slots
> used for short-term mapping has changed from per-CPU to per-thread.
> kmap_atomic() disable preemption, while kmap_local_*() only disable
> migration.
> There is no need to disable preemption in several kamp_atomic
> places used in fuse.
> The detailed introduction of kmap_local_*d can be found here:
> https://lwn.net/Articles/836144/
>
> Signed-off-by: Peng Hao <flyingpeng@tencent.com>

Thanks, applied.

Miklos

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH]  fuse: Use kmap_local_page()
@ 2021-09-08  8:38 Peng Hao
  2021-09-08  8:56 ` Miklos Szeredi
  0 siblings, 1 reply; 5+ messages in thread
From: Peng Hao @ 2021-09-08  8:38 UTC (permalink / raw)
  To: miklos; +Cc: linux-fsdevel

Due to the introduction of kmap_local_*, the storage of slots
used for short-term mapping has changed from per-CPU to per-thread.
kmap_atomic() disable preemption, while kmap_local_*() only disable
migration.
There is no need to disable preemption in several kamp_atomic
places used in fuse.
The detailed introduction of kmap_local_*d can be found here:
https://lwn.net/Articles/836144/

Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
 fs/fuse/dev.c     | 8 ++++----
 fs/fuse/ioctl.c   | 4 ++--
 fs/fuse/readdir.c | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index dde341a6388a..491c092d427b 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -756,7 +756,7 @@ static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size)
 {
 	unsigned ncpy = min(*size, cs->len);
 	if (val) {
-		void *pgaddr = kmap_atomic(cs->pg);
+		void *pgaddr = kmap_local_page(cs->pg);
 		void *buf = pgaddr + cs->offset;
 
 		if (cs->write)
@@ -764,7 +764,7 @@ static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size)
 		else
 			memcpy(*val, buf, ncpy);
 
-		kunmap_atomic(pgaddr);
+		kunmap_local(pgaddr);
 		*val += ncpy;
 	}
 	*size -= ncpy;
@@ -949,10 +949,10 @@ static int fuse_copy_page(struct fuse_copy_state *cs, struct page **pagep,
 			}
 		}
 		if (page) {
-			void *mapaddr = kmap_atomic(page);
+			void *mapaddr = kmap_local_page(page);
 			void *buf = mapaddr + offset;
 			offset += fuse_copy_do(cs, &buf, &count);
-			kunmap_atomic(mapaddr);
+			kunmap_local(mapaddr);
 		} else
 			offset += fuse_copy_do(cs, NULL, &count);
 	}
diff --git a/fs/fuse/ioctl.c b/fs/fuse/ioctl.c
index 546ea3d58fb4..fbc09dab1f85 100644
--- a/fs/fuse/ioctl.c
+++ b/fs/fuse/ioctl.c
@@ -286,11 +286,11 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
 		    in_iovs + out_iovs > FUSE_IOCTL_MAX_IOV)
 			goto out;
 
-		vaddr = kmap_atomic(ap.pages[0]);
+		vaddr = kmap_local_page(ap.pages[0]);
 		err = fuse_copy_ioctl_iovec(fm->fc, iov_page, vaddr,
 					    transferred, in_iovs + out_iovs,
 					    (flags & FUSE_IOCTL_COMPAT) != 0);
-		kunmap_atomic(vaddr);
+		kunmap_local(vaddr);
 		if (err)
 			goto out;
 
diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c
index bc267832310c..e38ac983435a 100644
--- a/fs/fuse/readdir.c
+++ b/fs/fuse/readdir.c
@@ -76,11 +76,11 @@ static void fuse_add_dirent_to_cache(struct file *file,
 	    WARN_ON(fi->rdc.pos != pos))
 		goto unlock;
 
-	addr = kmap_atomic(page);
+	addr = kmap_local_page(page);
 	if (!offset)
 		clear_page(addr);
 	memcpy(addr + offset, dirent, reclen);
-	kunmap_atomic(addr);
+	kunmap_local(addr);
 	fi->rdc.size = (index << PAGE_SHIFT) + offset + reclen;
 	fi->rdc.pos = dirent->off;
 unlock:
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-08  8:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAPm50aLNUNGo94u1yVKSJwy3rehRP84ha8YmbOdMyehFeVah0w@mail.gmail.com>
2021-08-17 15:41 ` [PATCH] fuse: Use kmap_local_page() Miklos Szeredi
2021-08-20  1:48   ` Hao Peng
     [not found]   ` <CAPm50aLXQC_Q+fEPsJaUJjn7ahHV57FM1vCOVwJpFfnghXXbzw@mail.gmail.com>
2021-09-07 15:04     ` Miklos Szeredi
2021-09-08  8:38 Peng Hao
2021-09-08  8:56 ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).