Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1822475ybl; Thu, 15 Aug 2019 01:42:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyy44LctcM2wjP0nHHW8UUk+XGzyARiEz6LDuQFwsoRXjRhssMAx3VBwbhAcIc7R7zlMN1A X-Received: by 2002:a17:902:b285:: with SMTP id u5mr3251253plr.329.1565858534157; Thu, 15 Aug 2019 01:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565858534; cv=none; d=google.com; s=arc-20160816; b=ihzMX179vxtTeds++t5XSjQGOxqDTlHEzgMhtjTfBXSiVGgUPYxlVUd+s8SrL1GCQY pedyk8S92LCgegA+pBjknnUjKCOYGMURvVvKigNVuIEUR1+nbap1i+bi5HIT59+K6nQ0 7BzOfA5yL3LOhOJMCKZY8cSmSmgcItuzMPCCnHKyDqB6Od+aFOD3ksBQb2e48fxsmzf0 9oV/8LrWzU4BBpYjm7PRs6kYtrISrq2E8FaPTE/P+zGEb0OnYuiAz5QHtBwj++wY4WdK s4GQO8CYL7YQJ17Qg3TnS9rLTzAab1OuRRScPUXVfYbarbHhKhTVfp71wefpDTlfEcV9 qdpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=E61FchG3gXE4PyuDoMYbMqKVXjB3bPwDrwju08G/2cI=; b=0G6VbS+fFNwOshzks8fcRK8dlSI/GgcXfe69q5UMDJIUcq15AiOwHCYUclYaPNlYZ9 O4drxUT7V5qEGPG8q7wbAvJKGr06J0nXPMFNYuQV55qngWPUQjZHvvpTJnaSPkpmx/B+ JFbqBEqJG51W3Or+JvZfS2HUMiNaJbLyDRW37wGkAUbJysSJncRo1YvQeb6E1tFRluYD L9tOoYfO0E0G9endLsv9YK6dIe+93Q6LN7gEL40j8pguY5RJ3quHIJK8rk7r0wKME1fR 3IbD5bmwfd9Ri14GZJqDjXFaOZBlR2DDvmjvnQUdCGaAfTqOEMXCkdzwJgIRBtobz2jX y1lg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si594904pjq.31.2019.08.15.01.41.50; Thu, 15 Aug 2019 01:42:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730932AbfHOIYg (ORCPT + 99 others); Thu, 15 Aug 2019 04:24:36 -0400 Received: from mx2.suse.de ([195.135.220.15]:35722 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730898AbfHOIYf (ORCPT ); Thu, 15 Aug 2019 04:24:35 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 82E48AE2C; Thu, 15 Aug 2019 08:24:34 +0000 (UTC) Date: Thu, 15 Aug 2019 10:24:33 +0200 From: Michal Hocko To: Edward Chron Cc: Andrew Morton , Roman Gushchin , Johannes Weiner , David Rientjes , Tetsuo Handa , Shakeel Butt , linux-mm@kvack.org, linux-kernel@vger.kernel.org, colona@arista.com Subject: Re: [PATCH] mm/oom: Add killed process selection information Message-ID: <20190815082433.GC9477@dhcp22.suse.cz> References: <20190815060604.3675-1-echron@arista.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190815060604.3675-1-echron@arista.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 14-08-19 23:06:04, Edward Chron wrote: > For an OOM event: print oom_score_adj value for the OOM Killed process > to document what the oom score adjust value was at the time the process > at the time of the OOM event. The value can be set by the user and it > effects the resulting oom_score so useful to document this value. This value is interesting especially for setups which do not print eligible tasks (sysctl oom_dump_tasks = 0) and helps to notice a misconfiguration or to confirm that oom_score_adj configuration applies as expected. > Sample message output: > Aug 14 23:00:02 testserver kernel: Out of memory: Killed process 2692 > (oomprocs) total-vm:1056800kB, anon-rss:1052760kB, file-rss:4kB,i > shmem-rss:0kB oom_score_adj:1000 > > Signed-off-by: Edward Chron With that feel free to add Acked-by: Michal Hocko and post as a stand alone patch. Btw. the patch could be simplified by not using a helper variable and using victim->signal->oom_score_adj right in the pr_err. Thanks! > --- > mm/oom_kill.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > index eda2e2a0bdc6..6b1674cac377 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -858,6 +858,7 @@ static void __oom_kill_process(struct task_struct *victim, const char *message) > struct task_struct *p; > struct mm_struct *mm; > bool can_oom_reap = true; > + long adj; > > p = find_lock_task_mm(victim); > if (!p) { > @@ -877,6 +878,8 @@ static void __oom_kill_process(struct task_struct *victim, const char *message) > count_vm_event(OOM_KILL); > memcg_memory_event_mm(mm, MEMCG_OOM_KILL); > > + adj = (long)victim->signal->oom_score_adj; > + > /* > * We should send SIGKILL before granting access to memory reserves > * in order to prevent the OOM victim from depleting the memory > @@ -884,12 +887,12 @@ static void __oom_kill_process(struct task_struct *victim, const char *message) > */ > do_send_sig_info(SIGKILL, SEND_SIG_PRIV, victim, PIDTYPE_TGID); > mark_oom_victim(victim); > - pr_err("%s: Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB\n", > + pr_err("%s: Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB oom_score_adj:%ld\n", > message, task_pid_nr(victim), victim->comm, > K(victim->mm->total_vm), > K(get_mm_counter(victim->mm, MM_ANONPAGES)), > K(get_mm_counter(victim->mm, MM_FILEPAGES)), > - K(get_mm_counter(victim->mm, MM_SHMEMPAGES))); > + K(get_mm_counter(victim->mm, MM_SHMEMPAGES)), adj); > task_unlock(victim); > > /* > -- > 2.20.1 -- Michal Hocko SUSE Labs