* [PATCH v2] mm: add warning if __vm_enough_memory fails
@ 2022-07-26 14:54 Kefeng Wang
2022-08-09 8:32 ` Kefeng Wang
2022-08-10 8:32 ` David Hildenbrand
0 siblings, 2 replies; 5+ messages in thread
From: Kefeng Wang @ 2022-07-26 14:54 UTC (permalink / raw)
To: Andrew Morton, linux-mm, linux-kernel
Cc: David Hildenbrand, Kefeng Wang, Yongqiang Liu
If a process has no enough memory to allocate a new virtual mapping, we
may meet kinds of error, eg, fork cannot allocate memory, SIGBUS error
in shmem, but it is difficult to confirm them, let's add some debug
information to easy to check this scenario if __vm_enough_memory fails.
Reported-by: Yongqiang Liu <liuyongqiang13@huawei.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
v2: use pr_warn_ratelimited, suggested by David Hildenbrand
mm/util.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/util.c b/mm/util.c
index 1266a33a49ea..c786e21c6051 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -1020,6 +1020,8 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
if (percpu_counter_read_positive(&vm_committed_as) < allowed)
return 0;
error:
+ pr_warn_ratelimited("%s: pid: %d, comm: %s, no enough memory for the allocation\n",
+ __func__, current->pid, current->comm);
vm_unacct_memory(pages);
return -ENOMEM;
--
2.35.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] mm: add warning if __vm_enough_memory fails
2022-07-26 14:54 [PATCH v2] mm: add warning if __vm_enough_memory fails Kefeng Wang
@ 2022-08-09 8:32 ` Kefeng Wang
2022-08-10 2:02 ` Andrew Morton
2022-08-10 8:32 ` David Hildenbrand
1 sibling, 1 reply; 5+ messages in thread
From: Kefeng Wang @ 2022-08-09 8:32 UTC (permalink / raw)
To: Andrew Morton, linux-mm, linux-kernel; +Cc: David Hildenbrand, Yongqiang Liu
Hi maintainer, any comments, thanks
On 2022/7/26 22:54, Kefeng Wang wrote:
> If a process has no enough memory to allocate a new virtual mapping, we
> may meet kinds of error, eg, fork cannot allocate memory, SIGBUS error
> in shmem, but it is difficult to confirm them, let's add some debug
> information to easy to check this scenario if __vm_enough_memory fails.
>
> Reported-by: Yongqiang Liu <liuyongqiang13@huawei.com>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> v2: use pr_warn_ratelimited, suggested by David Hildenbrand
>
> mm/util.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/mm/util.c b/mm/util.c
> index 1266a33a49ea..c786e21c6051 100644
> --- a/mm/util.c
> +++ b/mm/util.c
> @@ -1020,6 +1020,8 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
> if (percpu_counter_read_positive(&vm_committed_as) < allowed)
> return 0;
> error:
> + pr_warn_ratelimited("%s: pid: %d, comm: %s, no enough memory for the allocation\n",
> + __func__, current->pid, current->comm);
> vm_unacct_memory(pages);
>
> return -ENOMEM;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] mm: add warning if __vm_enough_memory fails
2022-08-09 8:32 ` Kefeng Wang
@ 2022-08-10 2:02 ` Andrew Morton
2022-08-10 6:19 ` Kefeng Wang
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2022-08-10 2:02 UTC (permalink / raw)
To: Kefeng Wang; +Cc: linux-mm, linux-kernel, David Hildenbrand, Yongqiang Liu
On Tue, 9 Aug 2022 16:32:46 +0800 Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
> Hi maintainer, any comments, thanks
Looks great to me - I have it saved away.
I prefer not to add new material during the merge window prior to MM
being fully merged up. In fact, I think this might be against
Stephen's rules-for-linux-next. Even during the merge window,
linux-next remains the testing ground for Linus's "next" release,
so adding next+1 material will weaken that testing.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] mm: add warning if __vm_enough_memory fails
2022-08-10 2:02 ` Andrew Morton
@ 2022-08-10 6:19 ` Kefeng Wang
0 siblings, 0 replies; 5+ messages in thread
From: Kefeng Wang @ 2022-08-10 6:19 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, linux-kernel, David Hildenbrand, Yongqiang Liu
On 2022/8/10 10:02, Andrew Morton wrote:
> On Tue, 9 Aug 2022 16:32:46 +0800 Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>
>> Hi maintainer, any comments, thanks
> Looks great to me - I have it saved away.
>
> I prefer not to add new material during the merge window prior to MM
> being fully merged up. In fact, I think this might be against
> Stephen's rules-for-linux-next. Even during the merge window,
> linux-next remains the testing ground for Linus's "next" release,
> so adding next+1 material will weaken that testing.
Got it, thanks~
> .
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] mm: add warning if __vm_enough_memory fails
2022-07-26 14:54 [PATCH v2] mm: add warning if __vm_enough_memory fails Kefeng Wang
2022-08-09 8:32 ` Kefeng Wang
@ 2022-08-10 8:32 ` David Hildenbrand
1 sibling, 0 replies; 5+ messages in thread
From: David Hildenbrand @ 2022-08-10 8:32 UTC (permalink / raw)
To: Kefeng Wang, Andrew Morton, linux-mm, linux-kernel; +Cc: Yongqiang Liu
On 26.07.22 16:54, Kefeng Wang wrote:
> If a process has no enough memory to allocate a new virtual mapping, we
> may meet kinds of error, eg, fork cannot allocate memory, SIGBUS error
> in shmem, but it is difficult to confirm them, let's add some debug
> information to easy to check this scenario if __vm_enough_memory fails.
>
> Reported-by: Yongqiang Liu <liuyongqiang13@huawei.com>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> v2: use pr_warn_ratelimited, suggested by David Hildenbrand
>
> mm/util.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/mm/util.c b/mm/util.c
> index 1266a33a49ea..c786e21c6051 100644
> --- a/mm/util.c
> +++ b/mm/util.c
> @@ -1020,6 +1020,8 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
> if (percpu_counter_read_positive(&vm_committed_as) < allowed)
> return 0;
> error:
> + pr_warn_ratelimited("%s: pid: %d, comm: %s, no enough memory for the allocation\n",
> + __func__, current->pid, current->comm);
> vm_unacct_memory(pages);
>
> return -ENOMEM;
Acked-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-10 8:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26 14:54 [PATCH v2] mm: add warning if __vm_enough_memory fails Kefeng Wang
2022-08-09 8:32 ` Kefeng Wang
2022-08-10 2:02 ` Andrew Morton
2022-08-10 6:19 ` Kefeng Wang
2022-08-10 8:32 ` David Hildenbrand
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.