Received: by 10.223.176.5 with SMTP id f5csp4190096wra; Tue, 30 Jan 2018 03:36:15 -0800 (PST) X-Google-Smtp-Source: AH8x224f5hm293/AhxeyK/e63XWPWbLqhJC6ozrZMN5Rtd3OFvspjZaA6izwcMgenNaGrR4LNN6N X-Received: by 2002:a17:902:203:: with SMTP id 3-v6mr25874653plc.413.1517312175494; Tue, 30 Jan 2018 03:36:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517312175; cv=none; d=google.com; s=arc-20160816; b=YtlvSijZVYPNXM1YKsCGfuCS3Wg62CLwsN7ifz8Jtd3hZvxhpU7CibJ7Q0Dqo87S9Y PvvfAdHvQQrPpbojnntC7wFidxEOeeeVyU7BvoU6EbM2pFdLqEbKjbRVIMzZAoW2tPQZ mTK+ipX7PD2+sCLa7gfPQFrYlSfMGKtiAlmky5RAwYw995GK7IjQRE6gycWOxuTGtD4e 1R04XHP1yQhTwkqr33hKEHgPguhcTT3Hiv6gw7LEU7aJn1/WxwmPVQH8XCkUzMXIB+bf z5Me3+9ebrpHVZEkD/3C186N62wgjtuGWiNllFJvsevxJ3TPbZU59126zCI7nQJdtq1y j7VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=Atkz3tHfoQI0hqeqC81bFzOTJsYcPuApWCCfxT+HUa0=; b=Dc5342Ge0RF5QJB+S5sZkh1oy0zrPrYUmK/RP8eiL7sEnO/XwaodfzkF4pKLqr7ivv SwnNzsJ+x6qYrYp8Tlceo5/YgJVubwvhkPkzvJXkJgf4Y6mKeASMPEJLtTjBYyW6wkQz ge/CQyzzOP434yM4mPGOzoVtw2E/MZ2seIBgORfP1BM81HdeNFIa30HpwxdjFHexW+Pa NjDGZb5naGycz/vAX8K+F2OmqB0j0c63l8ywzPwMs4AGv2int5HsZ4zZa6i9xQxO+Tos m7xfN3HFG6ZYj/N1Ai3ulz6k53UV57xGZLOVqTi7FjAfhI8kS5nGV2FOyrqKpYG0g9qH gaKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=f/abVqlM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14si9199437pgq.604.2018.01.30.03.36.00; Tue, 30 Jan 2018 03:36:15 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=f/abVqlM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751562AbeA3Lf1 (ORCPT + 99 others); Tue, 30 Jan 2018 06:35:27 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:38562 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751219AbeA3Lf0 (ORCPT ); Tue, 30 Jan 2018 06:35:26 -0500 Received: by mail-wm0-f53.google.com with SMTP id 141so444310wme.3 for ; Tue, 30 Jan 2018 03:35:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Atkz3tHfoQI0hqeqC81bFzOTJsYcPuApWCCfxT+HUa0=; b=f/abVqlMDTohOYQfYiS/lGOiVXgs7PwqMf32X9QgoF07lG4IrNIZGUUVBArV/TZ118 wqm85AmvgTnseg3h41PBuuyahgF4KfEPDt23zwTo5l+J5r292+413MHyptqB3le6zgOv Z57XqojGIcxCbsf+NVGrpWvRHSWBcQmF1aL5sqIR0jRF8D7rwcM/sYnUcOMKxq5Z9aSx gb66hmSEkwDteYm5Z5yIdKjKMVSkPblivFyVhsH+A635ZvBr1VW7IcNq+XYJCsLyaRcr hcXLd/9nXrwGpJi3MpOqJ+1UN/jEA4V55BoIt07vAzqkAMh9JcDddM9QpJTPPltWv2kz Wfvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Atkz3tHfoQI0hqeqC81bFzOTJsYcPuApWCCfxT+HUa0=; b=n5mQcFe4g55Cm8ne05LFpfOlacXvNa3x87UwJWTK5neqLE8VXv1eF++ukKPeumY/SZ W+x0H3FLihS8gml1UnWFGd1lFloq8IEXMg6hbQeZI8ZWUfxFm91aOO3Ri33udpPKR/eb Bg7M70ToQP9iWaTZpiKdKoZ+lQhaXYydf6/6iGIKlRIkP/1aN2NwlN3P6JyZVZpb6fLr 8p4S0YXvmoIN9o+5X57dtv/hwsVryWden1q9Y7Y7J/w0DymNS7IP5Ezh/DRZfViqnmR/ sowS65ae+7qgCzGs7DMA+gtSTFmPvT7DPam7YBHnGsFqhEnFe74wr1lID5J7dTF4JuCn hoAQ== X-Gm-Message-State: AKwxytcSSL0T0bAXCsh3hkip13/CUKtwnZPLr/VMla3eoE6TWhofDQj3 Z48VnBlVp/y3NoATluIJWz0= X-Received: by 10.80.231.6 with SMTP id a6mr42163517edn.240.1517312124705; Tue, 30 Jan 2018 03:35:24 -0800 (PST) Received: from [192.168.1.109] (80-33-144-85.ftth.glasoperator.nl. [85.144.33.80]) by smtp.gmail.com with ESMTPSA id a38sm7349237edf.97.2018.01.30.03.35.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 03:35:23 -0800 (PST) Subject: Re: [RFC] Per file OOM badness To: =?UTF-8?Q?Michel_D=c3=a4nzer?= , christian.koenig@amd.com, Michal Hocko , Roman Gushchin Cc: linux-mm@kvack.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org References: <20180123153631.GR1526@dhcp22.suse.cz> <20180124092847.GI1526@dhcp22.suse.cz> <583f328e-ff46-c6a4-8548-064259995766@daenzer.net> <20180124110141.GA28465@dhcp22.suse.cz> <36b49523-792d-45f9-8617-32b6d9d77418@daenzer.net> <20180124115059.GC28465@dhcp22.suse.cz> <381a868c-78fd-d0d1-029e-a2cf4ab06d37@gmail.com> <20180130093145.GE25930@phenom.ffwll.local> <3db43c1a-59b8-af86-2b87-c783c629f512@daenzer.net> <20180130104216.GR25930@phenom.ffwll.local> <5c3f8061-d2d2-fa33-faac-cb95e0b2d44b@daenzer.net> From: =?UTF-8?Q?Nicolai_H=c3=a4hnle?= Message-ID: Date: Tue, 30 Jan 2018 12:35:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <5c3f8061-d2d2-fa33-faac-cb95e0b2d44b@daenzer.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30.01.2018 11:48, Michel Dänzer wrote: > On 2018-01-30 11:42 AM, Daniel Vetter wrote: >> On Tue, Jan 30, 2018 at 10:43:10AM +0100, Michel Dänzer wrote: >>> On 2018-01-30 10:31 AM, Daniel Vetter wrote: >>> >>>> I guess a good first order approximation would be if we simply charge any >>>> newly allocated buffers to the process that created them, but that means >>>> hanging onto lots of mm_struct pointers since we want to make sure we then >>>> release those pages to the right mm again (since the process that drops >>>> the last ref might be a totally different one, depending upon how the >>>> buffers or DRM fd have been shared). >>>> >>>> Would it be ok to hang onto potentially arbitrary mmget references >>>> essentially forever? If that's ok I think we can do your process based >>>> account (minus a few minor inaccuracies for shared stuff perhaps, but no >>>> one cares about that). >>> >>> Honestly, I think you and Christian are overthinking this. Let's try >>> charging the memory to every process which shares a buffer, and go from >>> there. >> >> I'm not concerned about wrongly accounting shared buffers (they don't >> matter), but imbalanced accounting. I.e. allocate a buffer in the client, >> share it, but then the compositor drops the last reference. > > I don't think the order matters. The memory is "uncharged" in each > process when it drops its reference. Daniel made a fair point about passing DRM fds between processes, though. It's not a problem with how the fds are currently used, but somebody could do the following: 1. Create a DRM fd in process A, allocate lots of buffers. 2. Pass the fd to process B via some IPC mechanism. 3. Exit process A. There needs to be some assurance that the BOs are accounted as belonging to process B in the end. Cheers, Nicolai -- Lerne, wie die Welt wirklich ist, Aber vergiss niemals, wie sie sein sollte.