From patchwork Tue Jan 14 23:20:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Rientjes X-Patchwork-Id: 11332955 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B647C109A for ; Tue, 14 Jan 2020 23:20:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 75F3324670 for ; Tue, 14 Jan 2020 23:20:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="WEdiWoAH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 75F3324670 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 94BCE8E0005; Tue, 14 Jan 2020 18:20:08 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8FB708E0003; Tue, 14 Jan 2020 18:20:08 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7EBFE8E0005; Tue, 14 Jan 2020 18:20:08 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0177.hostedemail.com [216.40.44.177]) by kanga.kvack.org (Postfix) with ESMTP id 6A86C8E0003 for ; Tue, 14 Jan 2020 18:20:08 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id DE4198248D52 for ; Tue, 14 Jan 2020 23:20:07 +0000 (UTC) X-FDA: 76377810054.07.plane80_118a0ecd3754 X-Spam-Summary: 2,0,0,59b6a3d10eb56bb6,d41d8cd98f00b204,rientjes@google.com,:akpm@linux-foundation.org:mhocko@suse.com:linux-kernel@vger.kernel.org:,RULES_HIT:41:355:379:800:960:973:988:989:1260:1277:1313:1314:1345:1437:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3152:3352:3865:3866:3867:3868:3870:3871:3872:3874:5007:6261:6653:9010:10004:10400:11026:11657:11658:11914:12296:12297:12438:12517:12519:13069:13172:13229:13311:13357:13439:14181:14659:14721:21080:21324:21433:21444:21451:21627:30012:30054:30056,0,RBL:209.85.214.196:@google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: plane80_118a0ecd3754 X-Filterd-Recvd-Size: 3953 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jan 2020 23:20:07 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id p27so5866500pli.10 for ; Tue, 14 Jan 2020 15:20:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:user-agent:mime-version; bh=+W/hJ8TzLATqZod3a/d6aLW1agOHCtatzoP3Zrx0ONs=; b=WEdiWoAHhSS5cith0JJnt9gzqlaQmn9e6YCl3KEIpAvdf9hH89FF7BxVO+fzRtd/0o 7oiqJOUhS7lUkABkKtJ8Om4bI+38bBqx61xZr2hjaqmzQWKG0whBMAmJpZ5xa2Prk9ic 09Tq4nNbswotDFH8GPs3GXll83WQK9hhnH4RnvfJ/MGwdRj5awsIOpTCy9yCLCPEqJQl SaMcgdAS62trXxEpN7dO/INmboHDOusiKbUDXNDT6hgHvNJiCEU8o6YuJpIqJ3nm3FE6 +b99HXXPQbGDrWKDOcXFTBXfyCgQ/iJyk8ejmL3oukf0xsZW7LjFBnVurUHuYxBJJGp2 Xs/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:user-agent :mime-version; bh=+W/hJ8TzLATqZod3a/d6aLW1agOHCtatzoP3Zrx0ONs=; b=ixid0ns69QbdtL3V1cLXgXkJBd0D9hS9/ok2MEl919EVTRToXGYQeJlnOlwIdmsdLo Iue5DyP4YyHqqKKo0XyuQrxY1TkahG0iJbbONLrHaLxJa42VoOK/J0q5wZIRVUGV/cnh i5mCeeM+FMUEMF5h1I2YDw7uNFhcUxrKHph741y1iPnVPfKiCmTt6QTbf2CNpLDMzBRa no3XGR3izQlDXVhfQWk7JChXODdjTUFvvyjsrr9fNUb07zMZV4BzQ+4eVNrlZDdgy4/a U7Hhke9Bd9UJ+e5NbQBpaQ1FrIEAlyojwRTFXeMMQEIckFR7n+zLG0B/tzHE+YDB4Iid 0VDQ== X-Gm-Message-State: APjAAAXZjW38jy1WnPyWBI8NEgR9vNWwXMkHOe9Drtl2dj7L1dMY+yRy HkXILTeBDjHb2dr4pDqvbVlBZQ== X-Google-Smtp-Source: APXvYqx8JZSvymvRHUqirQm5dq/A28g8wevH1z+Oe5y4n6usub3bgOlLVXB2+nyjI4FvPWQM5kWTmA== X-Received: by 2002:a17:902:b611:: with SMTP id b17mr12491949pls.23.1579044006207; Tue, 14 Jan 2020 15:20:06 -0800 (PST) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id d22sm18150830pgg.52.2020.01.14.15.20.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 15:20:05 -0800 (PST) Date: Tue, 14 Jan 2020 15:20:04 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Andrew Morton cc: Michal Hocko , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [patch] mm, oom: dump stack of victim when reaping failed Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: When a process cannot be oom reaped, for whatever reason, currently the list of locks that are held is currently dumped to the kernel log. Much more interesting is the stack trace of the victim that cannot be reaped. If the stack trace is dumped, we have the ability to find related occurrences in the same kernel code and hopefully solve the issue that is making it wedged. Dump the stack trace when a process fails to be oom reaped. Signed-off-by: David Rientjes Acked-by: Michal Hocko --- mm/oom_kill.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/oom_kill.c b/mm/oom_kill.c --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -620,6 +621,7 @@ static void oom_reap_task(struct task_struct *tsk) pr_info("oom_reaper: unable to reap pid:%d (%s)\n", task_pid_nr(tsk), tsk->comm); + sched_show_task(tsk); debug_show_all_locks(); done: