Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp486164iog; Wed, 15 Jun 2022 06:24:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vIVgUULnvse2q7WpKTaFU94t+uwFAgisGBAIXdInFzaRo9q1UhfTNVDvX5ISqa9362FWtg X-Received: by 2002:a17:902:f314:b0:165:ddfc:5d84 with SMTP id c20-20020a170902f31400b00165ddfc5d84mr9588191ple.171.1655299476514; Wed, 15 Jun 2022 06:24:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655299476; cv=none; d=google.com; s=arc-20160816; b=AXwADrVEJ77XBS19CJK9mP60LSEObhKPKW/+UFC2n2XZZIGh7gYzFQ4UNywkXJdD6o sGxi9smzpsaPpH9CztHUpaBG+TUdXdhyMBQXmb8FwSfJacFqF6yRJi9cr35yWJcSZicu F6djnVuoQFd2xWC9IrWFV7dtEDIeLdEfSGvES3iXVC3vubDPhPidLYHSwjaRKPd48XIn DfogV9jSkbF3QrQ3to14BsDlrrsZzrkMH0nXJKTK3w1k5NrOJ+ptmzyIcnhvM/i7DtUC svD6YG/J/WWWScS8lKoeM+grk0lDd1+F13MdcshpG8R0BCysxJ4BJy6FUVoritDp1agk 5jeQ== 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=17VEqNPV/TBk73G7tKfWD0AkIggznFYMqcz7zsD4S9c=; b=sXUQGbMcMad4BVeJusjVawZlrSN2eCR06tvFcE+c4IFotdSoljtdrnIC/i56HqGLU5 eOHGvTIwHHQgS1s4pFBHUSoTDO1rRNvoaJhzwpwlYvoac6pg+9RBBdqHj7Jk0Fd612tm NDdlYfT4g4tPKVTjKo0EQ1Tb4VoPBhbkEdUMLiVL8qnFFvTipkSSDytgcAd6Hl8ak60V zOdD4e5QYrTVRZUxdveIhLQTk81yw248I0xlFlkeW7WG695Y8rR2nt+MdGAZJIbUjmjs Un6LF/sGSvc/bh7Fo6BP4/YmOQPo1fcEx8aaxsgIU8u+NqI0moqypIMP1sf/XOMU8179 a8hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=c5CplPzu; 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 x16-20020a17090a0bd000b001e67f6b069csi2405293pjd.131.2022.06.15.06.24.23; Wed, 15 Jun 2022 06:24:36 -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=c5CplPzu; 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 S1348637AbiFONP3 (ORCPT + 99 others); Wed, 15 Jun 2022 09:15:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348422AbiFONP1 (ORCPT ); Wed, 15 Jun 2022 09:15:27 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F2312A27B; Wed, 15 Jun 2022 06:15:26 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id BF13A21BB9; Wed, 15 Jun 2022 13:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1655298924; 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=17VEqNPV/TBk73G7tKfWD0AkIggznFYMqcz7zsD4S9c=; b=c5CplPzuxQh5gnp4bD34uWkKLEOaOc1Tpwslt5ARBi5fVdHjWZ4prxmWoQqcdCpqAG1Yor xmQuGVnUEOpCEt1XYqn7LUtFrFvMKUMl0YDT2F/jRq/vq+FW+bBxji/zHIwKJ8jaI2QMZs rqLOKCpvqZTZhxAjHRYVGQZVY5XNs10= 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 66BBD2C141; Wed, 15 Jun 2022 13:15:24 +0000 (UTC) Date: Wed, 15 Jun 2022 15:15:23 +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: <2e7e050e-04eb-0c0a-0675-d7f1c3ae7aed@amd.com> <288528c3-411e-fb25-2f08-92d4bb9f1f13@gmail.com> <34daa8ab-a9f4-8f7b-0ea7-821bc36b9497@gmail.com> <9e170201-35df-cfcc-8d07-2f9693278829@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9e170201-35df-cfcc-8d07-2f9693278829@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 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 Wed 15-06-22 14:35:22, Christian K?nig wrote: [...] > Even the classic mm_struct based accounting includes MM_SHMEMPAGES into the > badness. So accounting shared resources as badness to make a decision is > nothing new here. Yeah, it is nothing really new but it also doesn't mean it is an example worth following as this doesn't really work currently. Also please note that MM_SHMEMPAGES is counting at least something process specific as those pages are mapped in to the process (and with enough of wishful thinking unmapping can drop the last reference and free something up actually) . With generic per-file memory this is even more detached from process. > The difference is that this time the badness doesn't come from the memory > management subsystem, but rather from the I/O subsystem. > > > This is also the reason why I am not really fan of the per file > > badness because it adds a notion of resource that is not process bound > > in general so it will add all sorts of weird runtime corner cases which > > are impossible to anticipate [*]. Maybe that will work in some scenarios > > but definitely not something to be done by default without users opting > > into that and being aware of consequences. > > Would a kernel command line option to control the behavior be helpful here? I am not sure what would be the proper way to control that that would be future extensible. Kernel command line is certainly and option but if we want to extend that to module like or eBPF interface then it wouldn't stand a future test very quickly. -- Michal Hocko SUSE Labs