Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp544107iol; Thu, 9 Jun 2022 08:47:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwm+c59lp8PpxyFjoPTdHh/lb8ssAc5Cvcn5mFkyHVttQBYCaV0BPlrrem1tqz8XY4KELpE X-Received: by 2002:a63:8743:0:b0:3fe:c9c:b59 with SMTP id i64-20020a638743000000b003fe0c9c0b59mr12106671pge.192.1654789622845; Thu, 09 Jun 2022 08:47:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654789622; cv=none; d=google.com; s=arc-20160816; b=m91X8qV/6sRkvnKiB87nVKcuiM2TLBQYCOzkEs3snU+jdxaOIIGVB+VQtUnjjIz4Bl XG4M25H+5G4rx/nCIjCmMzvLQfH4f6cS5F3RGRbIrLlBPVsGwwFVAnBVHcYyL+reRybc ijvKNazooLq3md+lggDXKX0Egj6wz6jKvPvPOuLUYpwoxbebtDid2ewHcEwJTkbUedfb nU3Ysa4PGujHq7EUMeNPExvUz8T0TCwqm7cG7Wg6ktczno0llvZwidCGcUHk2gDyUFLO s6LlT36JlxNGCtcygwjum96SKoOcSzR07s5gp9V27l+uR49M3jOzrTs68sxozBaoi4ZD bTIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=5ijNQJtk6i4bS4QWxJisxGyfX37F5AKbQDFufqaSXZY=; b=ykh8O+AbGaiS9FukyiBhdHGIL0lzhSt85D11/SEk6qN7IiOVIV0mte63NkvI9LOrjt 1e6jU3uthvkegXIcHHjOUOwXgQfXJlpEV3f19lGUfSPUfV6RmC1O1CPRDV06RY9LOK6a qUA1H4lDlXeuvRLtoI+km4Ph8YKQmJRfOW81jq04qBhyELsOcgTFtGnSM3impjFmWgcX iRIh4SA6nxQTzb9CA4LihQaJeKL6Es0ZAIl6zHcsHtwMjTn2KKJ/yPgFV9GFB0iFdUBv Ol1TMJxAxJiFn5k7r52kmY8WpXuiFRrEHrVa8l9LbqNi5uwnPhub5MJGjTADKV6lMWeP l8ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=r0GH8a8O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t70-20020a638149000000b003f63e139713si34127154pgd.780.2022.06.09.08.46.49; Thu, 09 Jun 2022 08:47:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=r0GH8a8O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239519AbiFIPHL (ORCPT + 99 others); Thu, 9 Jun 2022 11:07:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237275AbiFIPHJ (ORCPT ); Thu, 9 Jun 2022 11:07:09 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21CB82823ED; Thu, 9 Jun 2022 08:07:06 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 94DBF1FE1A; Thu, 9 Jun 2022 15:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1654787225; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5ijNQJtk6i4bS4QWxJisxGyfX37F5AKbQDFufqaSXZY=; b=r0GH8a8OMYz9qCxwYnlpQdqJcDdzr81y+7Q96zHtHvv7mOhAiBSBx5z5skJYQuheM9fyrP OhwVH796ac6EGIP82Wqxy84XKU2xF2Fw406nnsVzRyzdtn3sZ8tyeYubU4helxrxefY3Ms g4pszhJLgKRiq4sTvLytSaOCon18h8E= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 4A85F2C141; Thu, 9 Jun 2022 15:07:05 +0000 (UTC) Date: Thu, 9 Jun 2022 17:07:04 +0200 From: Michal Hocko To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Christian =?iso-8859-1?Q?K=F6nig?= , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, alexander.deucher@amd.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hughd@google.com, andrey.grodzovsky@amd.com Subject: Re: [PATCH 03/13] mm: shmem: provide oom badness for shmem files Message-ID: References: <20220531100007.174649-1-christian.koenig@amd.com> <20220531100007.174649-4-christian.koenig@amd.com> <77b99722-fc13-e5c5-c9be-7d4f3830859c@amd.com> <26d3e1c7-d73c-cc95-54ef-58b2c9055f0c@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 09-06-22 16:29:46, Christian K?nig wrote: [...] > Is that a show stopper? How should we address this? This is a hard problem to deal with and I am not sure this simple solution is really a good fit. Not only because of the memcg side of things. I have my doubts that sparse files handling is ok as well. I do realize this is a long term problem and there is a demand for some solution at least. I am not sure how to deal with shared resources myself. The best approximation I can come up with is to limit the scope of the damage into a memcg context. One idea I was playing with (but never convinced myself it is really a worth) is to allow a new mode of the oom victim selection for the global oom event. It would be an opt in and the victim would be selected from the biggest leaf memcg (or kill the whole memcg if it has group_oom configured. That would address at least some of the accounting issue because charges are better tracked than per process memory consumption. It is a crude and ugly hack and it doesn't solve the underlying problem as shared resources are not guaranteed to be freed when processes die but maybe it would be just slightly better than the existing scheme which is clearly lacking behind existing userspace. -- Michal Hocko SUSE Labs