Received: by 10.223.176.46 with SMTP id f43csp715367wra; Fri, 19 Jan 2018 00:36:56 -0800 (PST) X-Google-Smtp-Source: ACJfBouFNmK4uBGeu+ibh/59k7Y9e7do2JJdLl7SQhqyDuDzt0iXFrbDDbnB6XTpDR6wDmdKTUn9 X-Received: by 2002:a17:902:36a:: with SMTP id 97-v6mr1233963pld.365.1516351016581; Fri, 19 Jan 2018 00:36:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516351016; cv=none; d=google.com; s=arc-20160816; b=isrv6pdXGEoloxc62xysUqkxIZ4ye9rHGTzqwh4rBiSS8DQblyM7Vx8RtRoPLszsmU 4TGFjdAKE+lMCrx1Wxg9hqvEEnfsAaLk8PNvnpOfUiUY7BLNXWm77jICsznSNqYhXj4j tpfcxN16Etie/6X0Uy90LlLHpdsaWBAPqnr4cgUl+rMOdTmRKTAvcvKZlejV984VxqEa DzK67NHvzMPnyBucrMAd6aQr82gDLu4AgokzDAAllHS0RwDsA1MaVzPlYy7Emd8DpntR cHNOWR1Lu8J/4HnXALtk+E+HEg5P7q5hygDlT2Qj4MZeXQmk/ES/PajCej/ZO1EMYt27 H9+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=0KJZGpveibmjT+i2G2KJzpfpriUWLlHDXVZtnuOktqc=; b=nPSBsQtM+pvViEicT/x4gBxLoboqUgsZLGWRDUnTGnSmQ8PgDE7vIjD7oE/SjXO15C ntaUhDFO/zQ3mBckNGQ5RltPpvTRGSG5cm4AEptRNg367lnWiowFADMr9FsCtI2EAK1R PBTwTQHVDmkIaxw3h9GP071D9oZbYDhij8DVRGB4NVI2hoxHUn+HsMHXTVfxD+Kv3Mak EwtbwsUDo6c4h8aWCV80uVluV64S0AfCq2IMs+/5HDVqiJZCYwoDeMajWb0IoQnDvtn6 ULhikHBfEQrXZ4f/gdjzypsu2NPk2tFKn4X4t38pXcPHYqlE2L+NmnMyjmYSqroePlYF DVhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=sdqMWUxu; 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 1-v6si657809plz.396.2018.01.19.00.36.41; Fri, 19 Jan 2018 00:36:56 -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=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=sdqMWUxu; 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 S1754909AbeASIgN (ORCPT + 99 others); Fri, 19 Jan 2018 03:36:13 -0500 Received: from mail-cys01nam02on0078.outbound.protection.outlook.com ([104.47.37.78]:51520 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754070AbeASIgF (ORCPT ); Fri, 19 Jan 2018 03:36:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=0KJZGpveibmjT+i2G2KJzpfpriUWLlHDXVZtnuOktqc=; b=sdqMWUxuaiBkQxc2ciow2LGQsv/nwSVD9zDYrHwNWdU3JjzdKJz38BU8z83KBm/DEHLPgUMmazFSQY290x39BKcB8r/SUUtyitfLufHz9guVHNsGNSTaJBMMzdUOBEyfVVjbcu5iWdjzA5jgkjzxOmsjprEZH+8TvrQVsGp5pGY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Christian.Koenig@amd.com; Received: from [IPv6:2a02:908:1251:8fc0:4c6d:7233:b7e1:3b88] (2a02:908:1251:8fc0:4c6d:7233:b7e1:3b88) by CY4PR12MB1302.namprd12.prod.outlook.com (10.168.168.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Fri, 19 Jan 2018 08:36:02 +0000 Subject: Re: [RFC] Per file OOM badness To: Eric Anholt , Michal Hocko , Andrey Grodzovsky Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org References: <1516294072-17841-1-git-send-email-andrey.grodzovsky@amd.com> <20180118170006.GG6584@dhcp22.suse.cz> <20180118171355.GH6584@dhcp22.suse.cz> <87k1wfgcmb.fsf@anholt.net> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <47fd8d6f-1c0e-388c-8c3d-a8784f8090ca@amd.com> Date: Fri, 19 Jan 2018 09:35:47 +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: <87k1wfgcmb.fsf@anholt.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [2a02:908:1251:8fc0:4c6d:7233:b7e1:3b88] X-ClientProxiedBy: AM5PR0602CA0009.eurprd06.prod.outlook.com (10.175.46.147) To CY4PR12MB1302.namprd12.prod.outlook.com (10.168.168.139) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 19ba1d1f-e202-4103-f755-08d55f17ad47 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534125)(4602075)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:CY4PR12MB1302; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1302;3:jLhk7PT9g7Ly0iP3mtDmaUQuMpCBIBjL0/Y3gExOxbDZA5zU1ABTHSSE0GO7fyyL8I/FEKOcbCu5jYldUQEJtiZmrGALGv7kJGUr5hNJ7UKJc57rrCF9MAI/ir/6vdg0OiE0VTAKpOyLUmMN7Tw88+Ym90mMR2PmzlG/81nmw2ZRNs5y0+u7seNwcydXy8iz7Ok8elMW0GwJMB1tO8/t35SxRkBZS7vaYjHL2tMpJeL4TI3SfbUVyWZNEYdBne7J;25:DCv/1o1lbWeW27BERu/b7M7weLZuKTz13whDyx/XuoL3b/jnOJSBcxfSefG5w9FRWJjtAvAJTWqMWbQ6kfHo5Y9AUtwqcpvK9xMRrkjMWHkd5ifsUID8+FT40qtmWFRp832vkgHxXA8ISue+1n6O9imj2/9AjaFNE8CiFV2T2daaCu+TRGO4jLoA3Wn6TP0WZ1gOGtW9uF3PqkjAqfF4glryVu472FFTU/8WJ+hhaUeNC9IrSmTGSxcR1pVZTmx1vJXc+4yQJD+tSzAze5vz2zuxDPlH1B34Bzf02cT/7JejQCzG+2SNWG1cZcJEDE5Ho7o39TtyY6X94DRTRV7myQ==;31:WVcmWSQow8U4rVbphS3scZQKbXSnVy/l5JIOSbEtj3Zpd0Nr35160vLMcnKNSSr28kcDKgIFGMP5XpIJONQ/81DqC4tzFc/q02ucX9zHhx3qEGT97X85/x7D97MnHcurxX0bAYQ52/4BOzvqbdRNEGjELZ9Hr1qjEBsJwPefwdd1NoJBOcresd4gm1jphIj29po72hgzdjMnMYReCysjejc66ScTy5vb6xVIJULpfaM= X-MS-TrafficTypeDiagnostic: CY4PR12MB1302: X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1302;20:XndYrrhM9QVnZCJH3CBX2LSJvaBInHf6Phc5j+3ogZihOO9ynLxks97PuKDzxzA3cJ85Og7Vy9gEzE/NvnxU7WXtoDY7yG+t4WywewelqTYPJplvqoh9c6q+C6DnwH1Bd4l53p56cS5v23T9NbPVR0cRsDuEob8VfMBY6b+RRRhqg2kzhNhBQ1V/7VlkxympR1vtTrd+8Go/UPOxh09YdIPK4TA6AGbbmIZxEoGYo34qFi5LJ8dFqDqzO+/senNlT5+KKzVecs1jDqmV+qJiaFj0eM977Zkbw49lZ6rjdtKxrkFONQTGHUeZYUM8Px/JiRSo7G/rvx3Tqs3UyXQZLoorYeaKjplme/zn7uGd+4xwJCls6bO9hH3vxrmQbP8juS8C8BSgvR5eKGdH9xR3bxd8KqV7g4ZDQuHqDqsXt9SaVgXJViXFRq3b1H5n77YOq9MinwIcCZ362ctf4isaR0FZyYVSKeI14SWI6c7vU2SLfuAcaaOsOkkiNcCY7KiU;4:Pv2KzKPG+Gpz58hWjE25aFchmGS/qHlQkS0JgOHKB8svddxpW0cF9SOcsgRf+CNkkDnb/XKDooT3wiqnOtPUg9yG41S/gSb7o8w5tz8fWeLREPoDNzOF7SlPYcLnL9UIzuzWNkCldHMjBwKMJFqnkxPXMy5XNXGIY0kP5xQWtKZFPQrT/ONoqxMb4iQRTH9x57Nbh88jWvG6cMqF8EIucyFFbCeifbzzNStcAZy5PF6G10TafAOQMNFxV8v9yoDsCrO86prVnJRbLF+sJDbBXa7TxgCKYqFSxJD9wohJCuQMEa2q+cZBCO39BwaHXY6/ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(5005006)(8121501046)(10201501046)(3231023)(2400074)(944501161)(93006095)(93001095)(3002001)(6055026)(6041268)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(6072148)(201708071742011);SRVR:CY4PR12MB1302;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:CY4PR12MB1302; X-Forefront-PRVS: 0557CBAD84 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(346002)(366004)(39380400002)(396003)(376002)(39860400002)(189003)(199004)(76104003)(316002)(65826007)(2906002)(5660300001)(83506002)(6486002)(25786009)(2950100002)(6666003)(6636002)(65956001)(64126003)(50466002)(47776003)(110136005)(1706002)(31686004)(58126008)(65806001)(59450400001)(105586002)(7736002)(305945005)(8936002)(86362001)(230700001)(4326008)(67846002)(23676004)(229853002)(106356001)(81166006)(81156014)(97736004)(386003)(53936002)(8676002)(6116002)(72206003)(6246003)(52396003)(478600001)(52146003)(93886005)(2486003)(52116002)(36756003)(68736007)(31696002)(76176011);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1302;H:[IPv6:2a02:908:1251:8fc0:4c6d:7233:b7e1:3b88];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMzAyOzIzOmdTQ202bWlsSnJvS044c0htRTlIMCtuYkhL?= =?utf-8?B?VTRwTjl2aFNNU1RYYndtbHY5eWllaTR0bHhsOUJNODBhL254SVFSTGdpa0kz?= =?utf-8?B?b2NEV0xKQ0dCRXc0RXRjSHg5ZDhISHZmNzJVc2duSmRtUU9la3RZbVRKbUZ0?= =?utf-8?B?VVQ0TTc2UjluSlkyOVFMM1FUa25PMzZxLzdYTXk0bE93MkpRMzB4eFJWWDJq?= =?utf-8?B?T3ZPaVhlbHNGcTdwbUtwTHBmWm92UFJIWlgvMDBNQ1lLVDFxdG1VeDNxdzVr?= =?utf-8?B?ZU4yeDFBQzVKMjZEZjNGdnZ5djRUZ1lvd1JMNVNjUEdNL085K2NrMzEzNmZ2?= =?utf-8?B?UDFndmpTb3AvRFB2YlJreGxrUFdET3JZZHhya3I3bVIzM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zF7Ej5qoKdzFr1g=;5:pz+4O0tvultH8PttzovaQi6iv/YdnLTNjZHUyX2sTEEEIvbDBNBOkdWxur4oEjoFpPCxFEi/hs7esjXsL6RsOV3xtzfT/fuvgIWBGQjULlPbT1PljL18uis2bNXlskcJXVFTu87hvef8UIn+dNJK3X03OrIlXVAUMX11/fGdJ0Q=;24:LU15zK2Lwv7MBf132xffHbfSIbBd1qlGyKCxWBcewkPpq3pzdVO9jnS8WWHxOQKgbUMaQeKu3OtxC5oValK/Nur1ACplwqsr7u8Jv3o4mDE=;7:t+2x4JTZl67pUwyNuuFkz0h8filZ2NKWgN63AtWIsrOf7xne/Qxo2YFPhWCbkyQAut7rv5TcuEYgpa9MoH6ZUFXlvBmvh2No3giaaGcBWVtVgkIZkngi+40n3V7JH5sFiuEjd2oxh6Hxc89XqMzsdWRUy4FXjB8ccaNz7zbbDv7z5Uhwz4KVS1OoHVMtKyAOVHsZpvs+Dxb0OnH10mrCMLsjmPEStKc8S2pM6ylVVIX3ZoliGKQOUNy3yWsR4V7D SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1302;20:HR2MUOW7GGaIGXvWeKNrLEMX46CfMzbPqCvpt8YZqTGs3/qGAPLgevGkVAOsguOMq5Q26ZjbzvqgGw9ip5UGUsGxkaKZccZD42YQl/+9svaFYIlKjJffkN07y8z7uzvAP+few7xHnQwIwC9xjT9pPkNbbsRIwNaiE+p4tOLeOAViC6I38hfhGdR3jC54mw4tvyYKjYirPqGkTkWfBPGKaZ7N9XGkeQlORzxdRMAIyKbA0+JB91VDEewFQK7iCVcv X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2018 08:36:02.0104 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 19ba1d1f-e202-4103-f755-08d55f17ad47 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1302 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 18.01.2018 um 21:01 schrieb Eric Anholt: > Michal Hocko writes: > >> [SNIP] >> But files are not killable, they can be shared... In other words this >> doesn't help the oom killer to make an educated guess at all. > Maybe some more context would help the discussion? Thanks for doing this. Wanted to reply yesterday with that information as well, but was unfortunately on sick leave. > > The struct file in patch 3 is the DRM fd. That's effectively "my > process's interface to talking to the GPU" not "a single GPU resource". > Once that file is closed, all of the process's private, idle GPU buffers > will be immediately freed (this will be most of their allocations), and > some will be freed once the GPU completes some work (this will be most > of the rest of their allocations). > > Some GEM BOs won't be freed just by closing the fd, if they've been > shared between processes. Those are usually about 8-24MB total in a > process, rather than the GBs that modern apps use (or that our testcases > like to allocate and thus trigger oomkilling of the test harness instead > of the offending testcase...) > > Even if we just had the private+idle buffers being accounted in OOM > badness, that would be a huge step forward in system reliability. Yes, and that's exactly the intention here because currently the OOM killer usually kills X when a graphics related application allocates to much memory and that is highly undesirable. >>> : So question at every one: What do you think about this approach? >> I thing is just just wrong semantically. Non-reclaimable memory is a >> pain, especially when there is way too much of it. If you can free that >> memory somehow then you can hook into slab shrinker API and react on the >> memory pressure. If you can account such a memory to a particular >> process and make sure that the consumption is bound by the process life >> time then we can think of an accounting that oom_badness can consider >> when selecting a victim. > For graphics, we can't free most of our memory without also effectively > killing the process. i915 and vc4 have "purgeable" interfaces for > userspace (on i915 this is exposed all the way to GL applications and is > hooked into shrinker, and on vc4 this is so far just used for > userspace-internal buffer caches to be purged when a CMA allocation > fails). However, those purgeable pools are expected to be a tiny > fraction of the GPU allocations by the process. Same thing with TTM and amdgpu/radeon. We already have a shrinker hock as well and make room as much as we can when needed. But I think Michal's concerns are valid as well and I thought about them when I created the initial patch. One possible solution which came to my mind is that (IIRC) we not only store the usual reference count per GEM object, but also how many handles where created for it. So what we could do is to iterate over all GEM handles of a client and account only size/num_handles as badness for the client. The end result would be that X and the client application would both get 1/2 of the GEM objects size accounted for. Regards, Christian.