Received: by 10.223.176.46 with SMTP id f43csp4059170wra; Tue, 23 Jan 2018 03:40:03 -0800 (PST) X-Google-Smtp-Source: AH8x225KD7fd+SPbuKl7bw60O7xUNcDU9i+cC77PGbYuV8DDaxZDinScAcvVt14l545Xl8Vj8VlL X-Received: by 10.99.122.82 with SMTP id j18mr8559048pgn.250.1516707603792; Tue, 23 Jan 2018 03:40:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516707603; cv=none; d=google.com; s=arc-20160816; b=Ix6mOo/9lUdbXvJiKc5umNqXjnrqB/MOqDknHPDgZ+P9YD3/gaTIJ6SbW+wNMxgK1a rD3Ibt/vKNM5CpkIrk16TDaD47ioA97WbFBDGA5WpqwWy5SZNa978V5+VPmDNqxA+BU9 v/dv2OADbq5vixJq7ih5C7iPpvGDvXVPxowMSX6996h0cic/jnqXbQsT2j8dNKRSFAOk 6avSb+scYBvT6Dcv/WobJ57EHBRQ1L+cJO8YB6a4oiEXzqHa+afwOdX3eFEI4i446ZzK ypd9dZ5uBFNL7k/iEEUObTGjURI+bUpF8oaupGK1Fa8dCdnS5iuGIguXR4sg1uVFlzgs Oiig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Pb/CeMhGAGQjRgonjyBDCxKJgTM1TIWc8SA9gpMosd8=; b=X+OK28BS1+DUBcN0lDyLWM7dH7EY1hKkKjVGByArmXNuR9h+NLPTG2Iph06XXhTaFg ZlMclU9QXPEk8I586T24CULdTq45aCSy/wHY3VumBpuADTFX9sSJhqqcj9HJaWGhqtB8 fdEmbU7tpHPW17ekFLErSS68nvOvy4Ry2rxCSt8+30R6kIojoQgSOdxEpY2X3/ZvxaFz DCVKr2u3ULSFi+X4ZP+jbPqR6JTQ1MQZUSG8vG+OFyyiOYSKX8/C+78fL1jWRVA8oCwd Tppv83vE2U10wmi/sEVDJtGQq+lbyoLIEEblOjFAHCvgT4rQ5JkRZa+BKVa/3sdoBui0 rD1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u8si14569394pgr.631.2018.01.23.03.39.48; Tue, 23 Jan 2018 03:40:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751315AbeAWLjQ (ORCPT + 99 others); Tue, 23 Jan 2018 06:39:16 -0500 Received: from mx2.suse.de ([195.135.220.15]:59842 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751173AbeAWLjP (ORCPT ); Tue, 23 Jan 2018 06:39:15 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1D4DFABE4; Tue, 23 Jan 2018 11:39:14 +0000 (UTC) Date: Tue, 23 Jan 2018 12:39:12 +0100 From: Michal Hocko To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Eric Anholt , Andrey Grodzovsky , linux-kernel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: Re: [RFC] Per file OOM badness Message-ID: <20180123113912.GH1526@dhcp22.suse.cz> References: <20180118170006.GG6584@dhcp22.suse.cz> <20180118171355.GH6584@dhcp22.suse.cz> <87k1wfgcmb.fsf@anholt.net> <20180119082046.GL6584@dhcp22.suse.cz> <0cfaf256-928c-4cb8-8220-b8992592071b@amd.com> <20180119104058.GU6584@dhcp22.suse.cz> <20180119121351.GW6584@dhcp22.suse.cz> <20180119122005.GX6584@dhcp22.suse.cz> <7c7b0616-97ba-01e7-0053-bf224ca5b5f2@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7c7b0616-97ba-01e7-0053-bf224ca5b5f2@amd.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 19-01-18 17:54:36, Christian K?nig wrote: > Am 19.01.2018 um 13:20 schrieb Michal Hocko: > > On Fri 19-01-18 13:13:51, Michal Hocko wrote: > > > On Fri 19-01-18 12:37:51, Christian K?nig wrote: > > > [...] > > > > The per file descriptor badness is/was just the much easier approach to > > > > solve the issue, because the drivers already knew which client is currently > > > > using which buffer objects. > > > > > > > > I of course agree that file descriptors can be shared between processes and > > > > are by themselves not killable. But at least for our graphics driven use > > > > case I don't see much of a problem killing all processes when a file > > > > descriptor is used by more than one at the same time. > > > Ohh, I absolutely see why you have chosen this way for your particular > > > usecase. I am just arguing that this would rather be more generic to be > > > merged. If there is absolutely no other way around we can consider it > > > but right now I do not see that all other options have been considered > > > properly. Especially when the fd based approach is basically wrong for > > > almost anybody else. > > And more importantly. Iterating over _all_ fd which is what is your > > approach is based on AFAIU is not acceptable for the OOM path. Even > > though oom_badness is not a hot path we do not really want it to take a > > lot of time either. Even the current iteration over all processes is > > quite time consuming. Now you want to add the number of opened files and > > that might be quite many per process. > > Mhm, crap that is a really good argument. > > How about adding a linked list of callbacks to check for the OOM killer to > check for each process? > > This way we can avoid finding the process where we need to account things on > when memory is allocated and still allow the OOM killer to only check the > specific callbacks it needs to determine the score of a process? I might be oversimplifying but there really have to be a boundary when you have the target user context, no? Then do the accounting when you get data to the user. -- Michal Hocko SUSE Labs