Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp247607iol; Thu, 9 Jun 2022 03:09:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/kOYXdWTdTgz6+XzsmSf9A/tAXMGlsHpl/Ea721vrnC7bCAd7HuGsQcb0GYhcW/xDy7UT X-Received: by 2002:a05:6402:6cc:b0:42d:bd2d:9f82 with SMTP id n12-20020a05640206cc00b0042dbd2d9f82mr44639017edy.59.1654769341403; Thu, 09 Jun 2022 03:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654769341; cv=none; d=google.com; s=arc-20160816; b=mvHNAycgsHxoxvrg6fvFH4U74APF7g1InRRwIIoSCMgx9rINhehqAElDDuMU1i+cb+ X0domLrhmsF4nvGGssafgKFyNYv+dtf74e9UmC7dr5g00W9k0qlNYkXfGQTdNzK8t/2d arIh78f5FsppXLwRkCQRpjWmj2zLppwfEQLvgqBmytB4Hbo9qqrG1V+yYUgAE2U32z8H qnwkzXepuThnU6VTfu71mJv6aGczQB+Xib1RKJtV5Tg58xovJo8nMoYylhh7cC9RM4V7 czP04GdREUDSfymS4ZhHoULFoxV/wIKuqI7AWyVCefhRrypUmGwjH0kciEvCKHt7PaiV gCWQ== 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=HayFit8bzwaDzpMDwYah/6SiOyQ4+BuRvDiuto6PjDE=; b=lGLiNIRw6XMu5j4PJgtdlwPaTaQwZ2wKYALJ9Cgw03US6nwLuQXNhAmfhYZob07l65 4+M5LTrRK/amwiqaFANzmGpe3Yd39ES1HctAdsl5HuqtpJ5psuuIJVHUHInifY9Zt5Fh 45jW08VPZ01YAU/5eEJCY+huR8JfQKZFtHlEdLBTa39gXexhiZ7aW28uCOmF/TBHGjS7 V6M6bbKpDgj3L4KDDUCRy3+x+0zOmC7yT6yeRrDRzm5vVR1X2j33Mb1iEjPE21BmLWru DRj+xrHrd4ISnmnBBJOrns+MG8ThTBGrG77dIu42RFAFUX5cB+37vaqZ6TbCGU/E36QC ZePw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=J3GHj6Ng; 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 nc23-20020a1709071c1700b006f464aa6a8csi4932462ejc.587.2022.06.09.03.08.33; Thu, 09 Jun 2022 03:09:01 -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=J3GHj6Ng; 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 S240882AbiFIJSo (ORCPT + 99 others); Thu, 9 Jun 2022 05:18:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240825AbiFIJSm (ORCPT ); Thu, 9 Jun 2022 05:18:42 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA1F91AF0E; Thu, 9 Jun 2022 02:18:40 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 897FE21DD8; Thu, 9 Jun 2022 09:18:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1654766319; 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=HayFit8bzwaDzpMDwYah/6SiOyQ4+BuRvDiuto6PjDE=; b=J3GHj6NgeZC2l6CCYS42pH1ur4gz/kZ8MjGwuv4MbjKYXuPXxJ+9p2sVq8TpFihaL3ga3L OiWYpUIDPFjIZgZ9CnMwU2mlrRW3/WMDJfS2SqBYd9qIWY6OST8injns6Do0hW5LlP8Sp/ haVizaclvKA0L+81Pw2138qaN9TGJvI= 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 351742C142; Thu, 9 Jun 2022 09:18:39 +0000 (UTC) Date: Thu, 9 Jun 2022 11:18:38 +0200 From: Michal Hocko To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: 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, christian.koenig@amd.com, 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> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220531100007.174649-4-christian.koenig@amd.com> 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 Tue 31-05-22 11:59:57, Christian K?nig wrote: > This gives the OOM killer an additional hint which processes are > referencing shmem files with potentially no other accounting for them. > > Signed-off-by: Christian K?nig > --- > mm/shmem.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/mm/shmem.c b/mm/shmem.c > index 4b2fea33158e..a4ad92a16968 100644 > --- a/mm/shmem.c > +++ b/mm/shmem.c > @@ -2179,6 +2179,11 @@ unsigned long shmem_get_unmapped_area(struct file *file, > return inflated_addr; > } > > +static long shmem_oom_badness(struct file *file) > +{ > + return i_size_read(file_inode(file)) >> PAGE_SHIFT; > +} This doesn't really represent the in memory size of the file, does it? Also the memcg oom handling could be considerably skewed if the file was shared between more memcgs. -- Michal Hocko SUSE Labs