linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: mmap_lock: fix disabling preemption directly
@ 2021-07-20  7:42 Muchun Song
  2021-07-20  9:39 ` Mel Gorman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Muchun Song @ 2021-07-20  7:42 UTC (permalink / raw)
  To: akpm, mgorman, shy828301, cuibixuan, vbabka
  Cc: linux-mm, linux-kernel, Muchun Song

The commit 832b50725373 ("mm: mmap_lock: use local locks instead of
disabling preemption") fix a bug by using local locks. But commit
d01079f3d0c0 ("mm/mmap_lock: remove dead code for !CONFIG_TRACING
configurations") changes those lines to original version. I guess
it is introduced by the conflicts fixing on merging.

Fixes: d01079f3d0c0 ("mm/mmap_lock: remove dead code for !CONFIG_TRACING configurations")
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 mm/mmap_lock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c
index f5852a058ce0..1854850b4b89 100644
--- a/mm/mmap_lock.c
+++ b/mm/mmap_lock.c
@@ -156,14 +156,14 @@ static inline void put_memcg_path_buf(void)
 #define TRACE_MMAP_LOCK_EVENT(type, mm, ...)                                   \
 	do {                                                                   \
 		const char *memcg_path;                                        \
-		preempt_disable();                                             \
+		local_lock(&memcg_paths.lock);                                 \
 		memcg_path = get_mm_memcg_path(mm);                            \
 		trace_mmap_lock_##type(mm,                                     \
 				       memcg_path != NULL ? memcg_path : "",   \
 				       ##__VA_ARGS__);                         \
 		if (likely(memcg_path != NULL))                                \
 			put_memcg_path_buf();                                  \
-		preempt_enable();                                              \
+		local_unlock(&memcg_paths.lock);                               \
 	} while (0)
 
 #else /* !CONFIG_MEMCG */
-- 
2.11.0


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

* Re: [PATCH] mm: mmap_lock: fix disabling preemption directly
  2021-07-20  7:42 [PATCH] mm: mmap_lock: fix disabling preemption directly Muchun Song
@ 2021-07-20  9:39 ` Mel Gorman
  2021-07-20 20:50 ` Yang Shi
  2021-07-20 21:50 ` Pankaj Gupta
  2 siblings, 0 replies; 4+ messages in thread
From: Mel Gorman @ 2021-07-20  9:39 UTC (permalink / raw)
  To: Muchun Song; +Cc: akpm, shy828301, cuibixuan, vbabka, linux-mm, linux-kernel

On Tue, Jul 20, 2021 at 03:42:28PM +0800, Muchun Song wrote:
> The commit 832b50725373 ("mm: mmap_lock: use local locks instead of
> disabling preemption") fix a bug by using local locks. But commit
> d01079f3d0c0 ("mm/mmap_lock: remove dead code for !CONFIG_TRACING
> configurations") changes those lines to original version. I guess
> it is introduced by the conflicts fixing on merging.
> 
> Fixes: d01079f3d0c0 ("mm/mmap_lock: remove dead code for !CONFIG_TRACING configurations")
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>

Acked-by: Mel Gorman <mgorman@techsingularity.net>

-- 
Mel Gorman
SUSE Labs

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

* Re: [PATCH] mm: mmap_lock: fix disabling preemption directly
  2021-07-20  7:42 [PATCH] mm: mmap_lock: fix disabling preemption directly Muchun Song
  2021-07-20  9:39 ` Mel Gorman
@ 2021-07-20 20:50 ` Yang Shi
  2021-07-20 21:50 ` Pankaj Gupta
  2 siblings, 0 replies; 4+ messages in thread
From: Yang Shi @ 2021-07-20 20:50 UTC (permalink / raw)
  To: Muchun Song
  Cc: Andrew Morton, Mel Gorman, cuibixuan, Vlastimil Babka, Linux MM,
	Linux Kernel Mailing List

On Tue, Jul 20, 2021 at 12:43 AM Muchun Song <songmuchun@bytedance.com> wrote:
>
> The commit 832b50725373 ("mm: mmap_lock: use local locks instead of
> disabling preemption") fix a bug by using local locks. But commit
> d01079f3d0c0 ("mm/mmap_lock: remove dead code for !CONFIG_TRACING
> configurations") changes those lines to original version. I guess
> it is introduced by the conflicts fixing on merging.
>
> Fixes: d01079f3d0c0 ("mm/mmap_lock: remove dead code for !CONFIG_TRACING configurations")
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>

Reviewed-by: Yang Shi <shy828301@gmail.com>

> ---
>  mm/mmap_lock.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c
> index f5852a058ce0..1854850b4b89 100644
> --- a/mm/mmap_lock.c
> +++ b/mm/mmap_lock.c
> @@ -156,14 +156,14 @@ static inline void put_memcg_path_buf(void)
>  #define TRACE_MMAP_LOCK_EVENT(type, mm, ...)                                   \
>         do {                                                                   \
>                 const char *memcg_path;                                        \
> -               preempt_disable();                                             \
> +               local_lock(&memcg_paths.lock);                                 \
>                 memcg_path = get_mm_memcg_path(mm);                            \
>                 trace_mmap_lock_##type(mm,                                     \
>                                        memcg_path != NULL ? memcg_path : "",   \
>                                        ##__VA_ARGS__);                         \
>                 if (likely(memcg_path != NULL))                                \
>                         put_memcg_path_buf();                                  \
> -               preempt_enable();                                              \
> +               local_unlock(&memcg_paths.lock);                               \
>         } while (0)
>
>  #else /* !CONFIG_MEMCG */
> --
> 2.11.0
>

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

* Re: [PATCH] mm: mmap_lock: fix disabling preemption directly
  2021-07-20  7:42 [PATCH] mm: mmap_lock: fix disabling preemption directly Muchun Song
  2021-07-20  9:39 ` Mel Gorman
  2021-07-20 20:50 ` Yang Shi
@ 2021-07-20 21:50 ` Pankaj Gupta
  2 siblings, 0 replies; 4+ messages in thread
From: Pankaj Gupta @ 2021-07-20 21:50 UTC (permalink / raw)
  To: Muchun Song
  Cc: Andrew Morton, Mel Gorman, shy828301, cuibixuan, Vlastimil Babka,
	Linux MM, LKML

> The commit 832b50725373 ("mm: mmap_lock: use local locks instead of
> disabling preemption") fix a bug by using local locks. But commit
> d01079f3d0c0 ("mm/mmap_lock: remove dead code for !CONFIG_TRACING
> configurations") changes those lines to original version. I guess
> it is introduced by the conflicts fixing on merging.
>
> Fixes: d01079f3d0c0 ("mm/mmap_lock: remove dead code for !CONFIG_TRACING configurations")
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> ---
>  mm/mmap_lock.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c
> index f5852a058ce0..1854850b4b89 100644
> --- a/mm/mmap_lock.c
> +++ b/mm/mmap_lock.c
> @@ -156,14 +156,14 @@ static inline void put_memcg_path_buf(void)
>  #define TRACE_MMAP_LOCK_EVENT(type, mm, ...)                                   \
>         do {                                                                   \
>                 const char *memcg_path;                                        \
> -               preempt_disable();                                             \
> +               local_lock(&memcg_paths.lock);                                 \
>                 memcg_path = get_mm_memcg_path(mm);                            \
>                 trace_mmap_lock_##type(mm,                                     \
>                                        memcg_path != NULL ? memcg_path : "",   \
>                                        ##__VA_ARGS__);                         \
>                 if (likely(memcg_path != NULL))                                \
>                         put_memcg_path_buf();                                  \
> -               preempt_enable();                                              \
> +               local_unlock(&memcg_paths.lock);                               \
>         } while (0)
>
>  #else /* !CONFIG_MEMCG */

Reviewed-by: Pankaj Gupta <pankaj.gupta@ionos.com>

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

end of thread, other threads:[~2021-07-20 21:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20  7:42 [PATCH] mm: mmap_lock: fix disabling preemption directly Muchun Song
2021-07-20  9:39 ` Mel Gorman
2021-07-20 20:50 ` Yang Shi
2021-07-20 21:50 ` Pankaj Gupta

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).