Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1457603pxb; Fri, 10 Sep 2021 06:25:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZELNJEyJevegofS+EqHW7ILGColeLtpQJwiGwYe/hM14q/06EBc6mo5SYzVcCVqhqwvZo X-Received: by 2002:a17:907:9602:: with SMTP id gb2mr9590769ejc.119.1631280341073; Fri, 10 Sep 2021 06:25:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631280341; cv=none; d=google.com; s=arc-20160816; b=Pj8mPqqAFnDE5LzB7keitVbRN0gf80+iVeMmLSrk1V4OEWyW1NHWkszh2o6e+cv2Qm iIEOJX3tq1b+w2d++Gz5LcYMPKYX4Uk5Fi21pDpDffRzZsUbHykVDS+34nqlxYtmy5m7 oW13TBgCGem4fSsT8FXbDbJcBDAiLNMg5leKFP4f43anaIk1az5JM5LFAQXqzaTpR6PS MCuRO7w6MPXToP9wutHfJH0qmxl59nM31r05Lkjz00y5mbsXoRgkTh6Xp6ZYQmlIGpko yZy3ltvzlzF/nAdElkoXtNMMPsMWQma5y+FgXWfG+A3f3s10XsDcok/e2O/Bd5fs+Zh1 lx5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=JVXUl/vOizFbXr36SIPs7G3RFOBb+JiAbzjybBgSVzo=; b=Bb0wtrb9gvTQe1NlL8DwM1x1vftEXZVxLqd6IqWrNl4FbDWgo45rkLWHDzocp+gJix LbY+K4eiEuGCMVnTdaCFJPIoRN4GS8xSBZn2gbF5gZzvIUU11G8jte4j46V0TluI2bMg meFuWBt6jLDiiwdrw5hX7hMpgv8Sc1Lscca/F5GYDjUAEH9FEDLOkheK9nEQBnNzYUNY Yo4MQEi1xmwz72boso1COB8q8eLGXYk+cIPWFGMyWhpTKMP06fhrZscEPjNRcgVTVV27 aw6n1T8sFOoIRREyxX6MB82JH3MF++xkxd9qBi+YS5p+T6uLM5JSzX7ZR1FIWRO7Uv1X xT3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=JLfwkFXu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eg38si4947118edb.243.2021.09.10.06.25.14; Fri, 10 Sep 2021 06:25:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=JLfwkFXu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233485AbhIJNWO (ORCPT + 99 others); Fri, 10 Sep 2021 09:22:14 -0400 Received: from relay.sw.ru ([185.231.240.75]:58268 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231963AbhIJNWN (ORCPT ); Fri, 10 Sep 2021 09:22:13 -0400 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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