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=-14.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 C4BB9C433EF for ; Fri, 10 Sep 2021 13:21:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5F7CB611CE for ; Fri, 10 Sep 2021 13:21:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5F7CB611CE Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id E4C896B0071; Fri, 10 Sep 2021 09:21:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DFC456B0072; Fri, 10 Sep 2021 09:21:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CEB8A900002; Fri, 10 Sep 2021 09:21:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0021.hostedemail.com [216.40.44.21]) by kanga.kvack.org (Postfix) with ESMTP id BB4246B0071 for ; Fri, 10 Sep 2021 09:21:04 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 5FF621829B8C6 for ; Fri, 10 Sep 2021 13:21:04 +0000 (UTC) X-FDA: 78571724448.01.7ACAFE3 Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) by imf26.hostedemail.com (Postfix) with ESMTP id C4A6A20019D3 for ; Fri, 10 Sep 2021 13:21:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Content-Type:MIME-Version:Date:Message-ID:From: Subject; bh=JVXUl/vOizFbXr36SIPs7G3RFOBb+JiAbzjybBgSVzo=; b=JLfwkFXuuXp3vd0TC /NFlQV+FNFjxEFpmxjyN2Xcau1dZ7GgOhyPyo4HrLhWmnInQ5e1thC1wdt+G+EvfHG8LCuyDQMo4D 6/cxxh6G/QICGAi+EGhYighds6CAGImWsDXVSdQm/rVweBBVKGuOa2flWL+Ih1/ZygDxHCACfnIBw =; Received: from [10.93.0.56] by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1mOgSg-001V2v-Il; Fri, 10 Sep 2021 16:20:58 +0300 Subject: Re: [PATCH memcg] memcg: prohibit unconditional exceeding the limit of dying tasks To: Tetsuo Handa Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michal Hocko , Johannes Weiner , Vladimir Davydov , Andrew Morton References: <5b06a490-55bc-a6a0-6c85-690254f86fad@virtuozzo.com> <099aa0db-045a-e5b8-6df7-b7c3fc4d3caa@i-love.sakura.ne.jp> From: Vasily Averin Message-ID: <4a407474-ff7a-9e4f-d314-ab85f0eeaadf@virtuozzo.com> Date: Fri, 10 Sep 2021 16:20:58 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <099aa0db-045a-e5b8-6df7-b7c3fc4d3caa@i-love.sakura.ne.jp> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C4A6A20019D3 X-Stat-Signature: bmawq6mzas6wt1bw3np436yign7u4wnn Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=virtuozzo.com header.s=relay header.b=JLfwkFXu; spf=pass (imf26.hostedemail.com: domain of vvs@virtuozzo.com designates 185.231.240.75 as permitted sender) smtp.mailfrom=vvs@virtuozzo.com; dmarc=pass (policy=quarantine) header.from=virtuozzo.com X-HE-Tag: 1631280063-282279 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 9/10/21 4:04 PM, Tetsuo Handa wrote: > On 2021/09/10 21:39, Vasily Averin wrote: >> The kernel currently allows dying tasks to exceed the memcg limits. >> The allocation is expected to be the last one and the occupied memory >> will be freed soon. >> This is not always true because it can be part of the huge vmalloc >> allocation. Allowed once, they will repeat over and over again. >> Moreover lifetime of the allocated object can differ from >> In addition the lifetime of the dying task. > > Can't we add fatal_signal_pending(current) test to vmalloc() loop? 1) this has been done in the past but has been reverted later. 2) any vmalloc changes will affect non-memcg allocations too. If we're doing memcg-related checks it's better to do it in one place. 3) it is not vmalloc-only issue. Huge number of kmalloc page allocations from N concurrent threads will lead to the same problem. >> Multiple such allocations running concurrently can not only overuse >> the memcg limit, but can lead to a global out of memory and, >> in the worst case, cause the host to panic. >> >> Signed-off-by: Vasily Averin