Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp172726ybl; Wed, 21 Aug 2019 17:02:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXejDey7sUv/PTnRooLn/8OrauIWUk/R3VquRm3Ra/s45CDeyfAHO4x2ebNdoyeO7lGWs4 X-Received: by 2002:a17:90a:db06:: with SMTP id g6mr2639313pjv.60.1566432152588; Wed, 21 Aug 2019 17:02:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566432152; cv=none; d=google.com; s=arc-20160816; b=My5hSBqaS7YHEZANVr2P3ukCj92yE6xUPZMnlGBfrrnVXA+q7nss0TSibKyK2N1dnN T5q7u8HRZYEEgX7nM0TWVc9gRmjlnY+hosKJYDQxrJg6c0FM0xvnyIk3oFB+tbx8IHUg feRaFfOPiRhkmwlLcUGEoN3gpW5gCrl1SodTpbIlOyt6ZHLblcKmlLVQo8uXl3XxcUwe LZ5juaITxatbzCUSwwdK5pjdZ//+0CY9CrWqggW+CsZm/Uwa+SfqG4+wKRMeS/D1uyPQ bUWLjSu2ewFcyqvfRNNBzHjtVeZ2paK34Xs8loKimF/tS6VC0kA1kQzz5iRcnTKUv1/P fByg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Oy2sEaeUKQmIQDPnRHPvhcv2oR+KrijeR8lZYw8C0/k=; b=dxZBPXwRqRxIktlFdxoVlpBuH9X5cm1t82rS0qeR4SvBOM5rxYRu4U4KbO5IjSXSUF WzgQ+LShjhVzsMKAYTh0EPFbRi3qqQ533ck+I7sDn9Dt5+rtCcLlzZZniZLZjrFqRqU2 ynXQ6B259226hEvwhXXd4rcrB/Ac5e9DWn/dGY1Cj8cZ9u8C1Q92yW9yUooCPBw8ETbp udU99ALw660sWGuJIcTmEDbatLC23PF2tBp1SNhu/nkq+T2XgvauDpPN78C2wIcVvYPj jse8+knA/AU2xMlqSgllttpvHL/dv0QOKn8xBqYuCvL2jDCZy2CzMUqfXUxuksgmr/MN rMqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=CSPe5oLS; 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=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh6si14578612plb.285.2019.08.21.17.02.18; Wed, 21 Aug 2019 17:02:32 -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; dkim=pass header.i=@arista.com header.s=googlenew header.b=CSPe5oLS; 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=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731126AbfHUWZ0 (ORCPT + 99 others); Wed, 21 Aug 2019 18:25:26 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:35691 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728995AbfHUWZ0 (ORCPT ); Wed, 21 Aug 2019 18:25:26 -0400 Received: by mail-io1-f67.google.com with SMTP id i22so7939040ioh.2 for ; Wed, 21 Aug 2019 15:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Oy2sEaeUKQmIQDPnRHPvhcv2oR+KrijeR8lZYw8C0/k=; b=CSPe5oLS5GCxhgWQHq7yG/45Wg9e/dcWfFbvVFUOIsEVMJdZpfA/aKz+r7CI1beOsg 86MdsJUsnV+wsOxFltJkf3VxoPs3AeT+rO9MHIufSAnfPYcJGgCo9VCu3C791QS2ksW8 fnVsI6EvzYRseYPoUwiicdAuYpiIrE3mZ4LUbeQYrGq+ffvzPF1WozYb9yFaPKcDXFlt VuF0CNfyYEmTcstqpLwpCtL6a1vV4HLPjueD8ZFRQAECGw5vNqbeZn/Sdt/LBlFb/FlP BykJ83k8VyhtKxLpHT1xX3wXOfcpZR2LPiidgFv/MpUnsXkVKkuChZE46KTAO+DgvcFq KKJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Oy2sEaeUKQmIQDPnRHPvhcv2oR+KrijeR8lZYw8C0/k=; b=qmIrB8dtxGKHJWhViexTiDs/5o6/oI0gFaYLNbfIVMTnjNvn4Bta12YAsSjWaR7N35 /t5ijQnCzofKhzYQqDviSR78VNpGxzbg2Q9o7StP4qm5e5ZiAXGEKH/mzVczSuhi3N5J f6Nez9Pu+5u3Ol8FhNsnopPR5neetmhVfSZsS+6mlZZVbqBkA/YVdNMPS4tTmkzV/4lx N/WEITqrXzdYIbBThF8wYtgc4XXhQ7vLueOobB5vWhkxYMPCFS+VOeL+qeq5R7/JKuIH gOf4cXai7pfyMgwP3r3nx+mCER5+pnp0upm3/KDjzmlfcS72HdAJY91DrHf9OlHL57tu J2ww== X-Gm-Message-State: APjAAAWB5y7j6MJf6lzw88LrEoPWb9t8RI6awiAtn0k+sD9M9l7lxPKx plylOzSLO2Rp2PuhUp5I7B/t4JP8X47RmO7YpOTAnQ== X-Received: by 2002:a5e:8e0d:: with SMTP id a13mr38379962ion.28.1566426325439; Wed, 21 Aug 2019 15:25:25 -0700 (PDT) MIME-Version: 1.0 References: <20190821001445.32114-1-echron@arista.com> In-Reply-To: From: Edward Chron Date: Wed, 21 Aug 2019 15:25:13 -0700 Message-ID: Subject: Re: [PATCH] mm/oom: Add oom_score_adj value to oom Killed process message To: David Rientjes Cc: Andrew Morton , Michal Hocko , Roman Gushchin , Johannes Weiner , Tetsuo Handa , Shakeel Butt , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ivan Delalande Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 20, 2019 at 8:25 PM David Rientjes wrote: > > On Tue, 20 Aug 2019, 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 was > > OOM Killed. The adjustment value can be set by user code and it affects > > the resulting oom_score so it is used to influence kill process selection. > > > > When eligible tasks are not printed (sysctl oom_dump_tasks = 0) printing > > this value is the only documentation of the value for the process being > > killed. Having this value on the Killed process message documents if a > > miscconfiguration occurred or it can confirm that the oom_score_adj > > value applies as expected. > > > > An example which illustates both misconfiguration and validation that > > the oom_score_adj was applied as expected is: > > > > Aug 14 23:00:02 testserver kernel: Out of memory: Killed process 2692 > > (systemd-udevd) total-vm:1056800kB, anon-rss:1052760kB, file-rss:4kB, > > shmem-rss:0kB oom_score_adj:1000 > > > > The systemd-udevd is a critical system application that should have an > > oom_score_adj of -1000. Here it was misconfigured to have a adjustment > > of 1000 making it a highly favored OOM kill target process. The output > > documents both the misconfiguration and the fact that the process > > was correctly targeted by OOM due to the miconfiguration. Having > > the oom_score_adj on the Killed message ensures that it is documented. > > > > Signed-off-by: Edward Chron > > Acked-by: Michal Hocko > > Acked-by: David Rientjes > > vm.oom_dump_tasks is pretty useful, however, so it's curious why you > haven't left it enabled :/ > > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > > index eda2e2a0bdc6..c781f73b6cd6 100644 > > --- a/mm/oom_kill.c > > +++ b/mm/oom_kill.c > > @@ -884,12 +884,13 @@ 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)), > > + (long)victim->signal->oom_score_adj); > > task_unlock(victim); > > > > /* > > Nit: why not just use %hd and avoid the cast to long? Sorry I may have accidently top posted my response to this. Here is where my response should go: ----------------------------------------------------------------------------------------------------------------------------------- Good point, I can post this with your correction. I will add your Acked-by: David Rientjes I am adding your Acked-by to the revised patch as this is what Michal asked me to do (so I assume that is what I should do). Should I post as a separate fix again or simply post here? I'll post here and if you prefer a fresh submission, let me know and I'll do that. Thank-you for reviewing this patch.