linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shakeel Butt <shakeelb@google.com>
To: Charan Teja Reddy <charante@codeaurora.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	David Rientjes <rientjes@google.com>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	vinmenon@codeaurora.org, Linux MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: oom_kill: add trace logs in process_mrelease() system call
Date: Mon, 16 Aug 2021 07:19:03 -0700	[thread overview]
Message-ID: <CALvZod5C1zu=wm00x686bayt3RAowDUmK15-675DOeUMOe_SPA@mail.gmail.com> (raw)
In-Reply-To: <1629106756-20874-1-git-send-email-charante@codeaurora.org>

On Mon, Aug 16, 2021 at 2:39 AM Charan Teja Reddy
<charante@codeaurora.org> wrote:
>
> The process_mrelease() system call[1] is used to release the memory of
> a dying process from the context of the caller, which is similar to and
> uses the functions of the oom reaper logic. There exists trace logs for
> a process when reaped by the oom reaper. Just extend the same to when
> done by the process_mrelease() system call.
>
> [1] https://lore.kernel.org/linux-mm/20210809185259.405936-1-surenb@google.com/
>
> Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
> ---
>  mm/oom_kill.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 431d38c..8f4020a 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -941,7 +941,6 @@ static void __oom_kill_process(struct task_struct *victim, const char *message)
>         mmdrop(mm);
>         put_task_struct(victim);
>  }
> -#undef K
>
>  /*
>   * Kill provided task unless it's secured by setting
> @@ -1199,8 +1198,18 @@ SYSCALL_DEFINE2(process_mrelease, int, pidfd, unsigned int, flags)
>                 ret = -EINTR;
>                 goto drop_mm;
>         }
> +       trace_start_task_reaping(task->pid);
>         if (!__oom_reap_task_mm(mm))
>                 ret = -EAGAIN;
> +       if (!ret) {
> +               pr_info("process_mrelease: reaped process %d (%s), now anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB oom_score_adj:%d\n",
> +                       task_pid_nr(task), task->comm,
> +                       K(get_mm_counter(mm, MM_ANONPAGES)),
> +                       K(get_mm_counter(mm, MM_FILEPAGES)),
> +                       K(get_mm_counter(mm, MM_SHMEMPAGES)),
> +                       task->signal->oom_score_adj);

Tracing is good but I don't think we want this line to be flooding the
kernel logs. I would recommend either simply removing it or adding
another trace for this, so only folks interested in this info can get
it.

      reply	other threads:[~2021-08-16 14:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16  9:39 [PATCH] mm: oom_kill: add trace logs in process_mrelease() system call Charan Teja Reddy
2021-08-16 14:19 ` Shakeel Butt [this message]

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='CALvZod5C1zu=wm00x686bayt3RAowDUmK15-675DOeUMOe_SPA@mail.gmail.com' \
    --to=shakeelb@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=charante@codeaurora.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=rientjes@google.com \
    --cc=surenb@google.com \
    --cc=vinmenon@codeaurora.org \
    /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;
as well as URLs for NNTP newsgroup(s).