From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91F45C33CB3 for ; Thu, 16 Jan 2020 21:06:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 545E02075B for ; Thu, 16 Jan 2020 21:06:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kNW0UDv2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 545E02075B 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 E16828E0090; Thu, 16 Jan 2020 16:05:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DEE168E0089; Thu, 16 Jan 2020 16:05:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D2C1C8E0090; Thu, 16 Jan 2020 16:05:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id BE5C68E0089 for ; Thu, 16 Jan 2020 16:05:59 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 652E2181AEF10 for ; Thu, 16 Jan 2020 21:05:59 +0000 (UTC) X-FDA: 76384729638.18.hose60_6e6f8ef2c975f X-HE-Tag: hose60_6e6f8ef2c975f X-Filterd-Recvd-Size: 4882 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Thu, 16 Jan 2020 21:05:58 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id s21so8862243plr.7 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=CNl5/e4CZZBHXFV0v4SgYhgFdU75XD88k8vUIAh/fi/08vW2Dud4JiMBIag/fNeiYP 6kNKX3iMR/Im2ltlMBZZwr2O9mirSS5exgr+oYRgMACfX8sUj5iG9/U3v2150ifYMxJg r6jAYLju1FfGGxYfkHaVgc+jKTGCzhQZ86bBpJ7XrI/agN1KBHRZhBPAH/u/DyU5wKKM f2N3zhbvlWbggeMMEugXmtyt1+tzrWz4SajOMe7lh9WHCU1813n1hvtEUql3SwkYg2wj Q4lS7gzdjYE2+TraqmBOGAm/CKEIMAco3Q0Zsi5FQ73SK6U3tzoob9KIBJ49KxNGgvNk 0aCw== X-Gm-Message-State: APjAAAX9YcyDV8P5tbCRIslnX02iGrA2QXI1lyWARjr96AcpzSKSUsAC 2mpCrxLleZiNTAggTpjGOU4k+g== X-Google-Smtp-Source: APXvYqzOFbR9rr/janV/gfdMZqa7nHLObA91eV42iB+A0tw887kkzh0tVTVAeKHb9ISe9/UMOfc39w== 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 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: 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.