Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8445177ybl; Thu, 16 Jan 2020 17:02:21 -0800 (PST) X-Google-Smtp-Source: APXvYqx1WqXeVdrm+rZ2/hkvL/X4fJqCemgqA3zB9KzdQDCtuZzDypvoUIcu6P82t9HeAGqPaDSh X-Received: by 2002:a9d:6005:: with SMTP id h5mr4601231otj.153.1579222941392; Thu, 16 Jan 2020 17:02:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579222941; cv=none; d=google.com; s=arc-20160816; b=jtlbipMrQeXse7pAcbl4CALzauetOdtjmNr7+keLY2ov1BsRfUU7Du15gn5E2IJ5/4 Bz7nwHKeKt/qEyXf7kCBSyzaiiJumfmNrqt1ISNyovcAUI0sNJcfdMHBC/UHt8oegwlI NGbKw0/2UXERt8+GlRU/0DnuHHCsn4AUeBwFI19BBQnkQWlB8NIb39984D79Yk7EC8H/ uVuHCXr5FpxU4sro2ycow819edIhXl3dPMEiB/SOQS14crg1qN58RmSxh/B7ZonkgO0B 43TvFw4eVXfH+5DBvq/k7VcNmIO4iliwl57cbvCS9eoQ1ItsZl0MWQZw8WhJ4F0tdarM VVnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=ztqTmZ7YiqRf6ApCzAEB+/k7Mj4yZkONfuvT5Qk/M94=; b=rUxOGn2lPKC5pq5ZzWHKjzGJ+zFqmqoYeGW1iYItrWFwvuceVxYhMLq8J0tyHpSUXr N3v45Z+O7MYxQp6qhlrTRYPUqvgtEjflLkOs60m4o3iU0wE2Qwee37pRcQGdRqtaTq2y yMzCKTb8SbtG64lPLfP29SX42i77GJdVknF2KuJt36TTGlac9sBVeTBYmb5OjdCNswHi VAWRn5SCfBaG9op0oXl9RZ48jv0P8orXeaLW6ASHXGS8lGq86bKDQvpgnlQlMqyS7NMF G4ncc+FCjgU/R4KIkjqLu3vM/wCKxpHy9Vq6i14mJyN7JZWiBVlop4j1Vj5s3HGYqWrl gKNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kNW0UDv2; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si12809718oib.59.2020.01.16.17.02.08; Thu, 16 Jan 2020 17:02:21 -0800 (PST) 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=@google.com header.s=20161025 header.b=kNW0UDv2; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387832AbgAPVF6 (ORCPT + 99 others); Thu, 16 Jan 2020 16:05:58 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:33688 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727040AbgAPVF6 (ORCPT ); Thu, 16 Jan 2020 16:05:58 -0500 Received: by mail-pl1-f194.google.com with SMTP id ay11so8871700plb.0 for ; Thu, 16 Jan 2020 13:05:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=ztqTmZ7YiqRf6ApCzAEB+/k7Mj4yZkONfuvT5Qk/M94=; b=kNW0UDv2/8wGSElhlvzmne2xJbuCS0295e/QWJQltkChHiMM1ccvnLMx/xMdgspFeW 8nrbCpIRigEYvOpeiF/TisClyOU6qRiuBCTQy8EX7ZA+tgJ7nE5bOQP1jkigxeN4XDl6 Vx3DRMKDtfdoVoDALLWwUjacsLpjnom3mXr1M//g++5lYA2wmeRABZAfZUvb9NMROtcu RE8MTTE5/W5lrSwoOQmXuv9olAY2uC1UL3CCTNNk43GiuhfT+5HQ9JkMlyu4ZA6P9fl2 1h56C2TC6eBBPl8tCF/S/JTvfj6L4mL4QPX68YKJTHjqVHeI4pbqZF97S+wqO4lZGSWi b/kw== 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:in-reply-to:message-id :references:user-agent:mime-version; bh=ztqTmZ7YiqRf6ApCzAEB+/k7Mj4yZkONfuvT5Qk/M94=; b=jjfclDQUlqJPk9SNqGZN9UGZR05okcm8rMYXSg2Nhq7O3kNHAPWCA2mw0tCzjnU+If oKfTgLI9bqytImY/7JOw2iQozZMcERMuEcGYBKC3BRoI6MxBFw1ZH90Otg2EfNBf0mVt UICtLHQO41zXgUFOnJjydIHANCDoj62ODrHgOL/5NwwS6uVDgSpyehnY9SCulMe6NSWv 6MTJ24xOmbqGueBJ6qr1np22URH5PtF0mNwwryoR/9LCFV1+cZg8xnyBQxCn3Z5NHiYs NzDuInnA7X0Mf48pIudKzltdl5ALtyWD8wlDx9echT7ZqSH3HrBXWMh1VNx/VkD3JuV5 tgwQ== X-Gm-Message-State: APjAAAUU/D0TiJIVWY6w9ukn2AzDNTfMHrQSZFrYruN2hFvufNmP3uPG hMGuWV99us0XmrZORERrAcG8QbanbFo= X-Received: by 2002:a17:902:d711:: with SMTP id w17mr35055534ply.303.1579208757499; Thu, 16 Jan 2020 13:05:57 -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 64sm27049026pfd.48.2020.01.16.13.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 13:05:56 -0800 (PST) Date: Thu, 16 Jan 2020 13:05:56 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Tetsuo Handa cc: Michal Hocko , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [patch] mm, oom: dump stack of victim when reaping failed In-Reply-To: <84fddb8e-a23b-e970-c8e9-74aa2fe2716d@i-love.sakura.ne.jp> Message-ID: References: <20200115084336.GW19428@dhcp22.suse.cz> <9a7cbbf0-4283-f932-e422-84b4fb42a055@I-love.SAKURA.ne.jp> <84fddb8e-a23b-e970-c8e9-74aa2fe2716d@i-love.sakura.ne.jp> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 16 Jan 2020, Tetsuo Handa wrote: > > I'm > > currently tracking a stall in oom reaping where the victim doesn't always > > have a lock held so we don't know where it's at in the kernel; I'm hoping > > that a stack for the thread group leader will at least shed some light on > > it. > > > > This change was already proposed at > https://lore.kernel.org/linux-mm/20180320122818.GL23100@dhcp22.suse.cz/ . > Hmm, seems the patch didn't get followed up on but I obviously agree with it :) > And according to that proposal, it is likely i_mmap_lock_write() in dup_mmap() > in copy_process(). We tried to make that lock killable but we gave it up > because nobody knows whether it is safe to do make it killable. > I haven't encountered that particular problem yet; one problem that I've found is a victim holding cgroup_threadgroup_rwsem in the exit path, another problem is the victim not holding any locks at all which is more concerning (why isn't it making forward progress?). This patch intends to provide a clue for the latter. Aside: we may also want to consider the possibility of doing immediate additional oom killing if the initial victim is too small. We rely on the oom reaper to solve livelocks like this by freeing memory so that allocators can drop locks that the victim depends on. If the victim is too small (we have victims <1MB because of oom_score_adj +1000!) we may want to consider additional immediate oom killing because it simply won't free enough memory.