Received: by 10.223.176.46 with SMTP id f43csp1253876wra; Fri, 19 Jan 2018 08:56:56 -0800 (PST) X-Google-Smtp-Source: ACJfBosXP8YeUpEy4R/rj/P2q5FK0oEnUGkcvNd3hJVQ2D7X7Rc7Reg9KRY3pmWnaoLX2vqZrncf X-Received: by 10.99.124.2 with SMTP id x2mr29245549pgc.184.1516381016406; Fri, 19 Jan 2018 08:56:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516381016; cv=none; d=google.com; s=arc-20160816; b=pcFl/iT3yt++5XxCuSjPKPDgdhQTGMwSxLNp4GyvWfCGBc4tY4lH0cCODgvWdDWUn6 jP0YT7y/F8oFtUnsDQXsAZbeZKbCHSM2Aj2a0BaHJM+5XDxE5/Jw942Fsi54Wh38eLvM tIJ8WcQrbOBrc1F4LcCcaGbLb9A5CRB4fAOsfQuEEPRx1hSRu3C3TAlsA6NfXucIs33N AMrwxfxOdP+N34SMeFkFyV3A0GirlaEps1NJy9lss26s/GykJ/7StpxVWG7FRZt09Bvv B2CtBtawn+mHuBOI9xfm44q0ydhORFWdSEG3pgaXxRaTwN49e1Bl75vssAgA/kEjoI+C 4NOw== 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=V1OQIcei8q6oRPMM0N9hXRtbPjuPQXrz4d3CbNLkBdA=; b=qBYci8f3UhxGw3rJ2rNyOX+uIGV1n07C8wIj2Mo1QLawnyLoA2iBqcuNKxxmVbgo/e dPcScIlqpGaa9Wxz5bWr3x5vaNQQhFbXYcF1fcWm3sZlgaRWKtAFARupY+YGmDIIzKym IcHcnmbmp/8pFKyOFF/4QbaO2sB1twUWOerYmWWcshrHQ95LRCotDV4HdDQpR1n9i/Uy ZLSWYPseXAmJvYiDH0luQNzdEZBhJogKQsCOYpRZdiY0K9F7j846gTzVAyYPcOAhNOHd f2LuurQ2JFppk3UcdgpkzwEjzGKszYSFl3X7FDfKf8HJGDuGNasdCBPjw1xHQccPC4WB CZgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=QWqgSnMl; 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 t9-v6si953325plr.184.2018.01.19.08.56.41; Fri, 19 Jan 2018 08:56: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=QWqgSnMl; 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 S1756070AbeASQzA (ORCPT + 99 others); Fri, 19 Jan 2018 11:55:00 -0500 Received: from mail-by2nam03on0075.outbound.protection.outlook.com ([104.47.42.75]:34045 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755772AbeASQyy (ORCPT ); Fri, 19 Jan 2018 11:54:54 -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=V1OQIcei8q6oRPMM0N9hXRtbPjuPQXrz4d3CbNLkBdA=; b=QWqgSnMlzuqK9qvmAbo7uATQCvTacrjlKKXSJWEXDom/gTZ7HIHvStJbS8qGBXnwNumciOJemscfbpc/5K3dvBNNGDzE0cYvNLktNqi3HfeBr43odGx5+kns9PJLGuxD5ff4U5erJxieS/5PkLdwqt+DTugJmZJPL0T8L0+4LEI= 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 MWHPR12MB1310.namprd12.prod.outlook.com (10.169.205.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Fri, 19 Jan 2018 16:54:49 +0000 Subject: Re: [RFC] Per file OOM badness To: Michal Hocko Cc: Eric Anholt , Andrey Grodzovsky , 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> <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> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <7c7b0616-97ba-01e7-0053-bf224ca5b5f2@amd.com> Date: Fri, 19 Jan 2018 17:54:36 +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: <20180119122005.GX6584@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [2a02:908:1251:8fc0:4c6d:7233:b7e1:3b88] X-ClientProxiedBy: HE1PR0102CA0056.eurprd01.prod.exchangelabs.com (10.167.35.33) To MWHPR12MB1310.namprd12.prod.outlook.com (10.169.205.135) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 28829c09-613d-4564-5ae8-08d55f5d5b63 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020);SRVR:MWHPR12MB1310; X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1310;3:EDSKtdkVMxszlreuxIUIqKo5uwHg04gfarhbBcqzK0KdIXUvK/09VutbMQlHh6zcR/VCdfl4SAAIcJMgcJ/GW0qpvJT7sfTfewCCUmEGqhZ6xJB6XcHTyMudhACEi9ewQMunkyWSZEpVB5nlf5/a/P2gorZJofc+21gtGmE7ZiSxZ8U5DC2OcR42BfulCquVCKMbpPDqrcBYm4uD2BS/75Zy150UsM90GYIQPwE70EQc+FRRUXAQqQXtQYlIwnkQ;25:/hZ/hD7jmQMtmUY0Sa5rKFQiGd8M6rjb1SUbcv95QLD4TDl0VsFJc+6RNBl/uLS6Cz5QZr9QmxdBqgwGyHnQtXzpcPGR7FYXl0aIxrS0YmjWtVOdBcy0pW9DPk8IKw+zs/YXCNy/xqGDjnMyfl5MKmwkzUSAY3Crq0g7ezqldiNdFoRNBctOGUY7AiBya7L4MiCKDdTO9YbH1dt2llBfz8fAgj5u9CVKihiQbrEdZ2O/urpxEVwnNDn8LrwQHkQvCayTrf2ploFEuCiZfdOSBmgjaOHo02rApBSKtbG7qnTrQYVH8gARG/KX8EmXPJHlUxVY+mmaf5pcJ04X0x6YmQ==;31:xn9AIW8SQeGCwSlweWKjVjZ7A7PDPFrA5oRR8A1zbW7EqMzaE1jxvFnUfhYbFDZE1vVR9pjikWbJ1UO4ryLsmKasmK2XYGf2EEvC9DFSKTvYsOT5IC6laFOT7wg+B5vZAyG0PzwviTbCagIA/3x0+huNe4B0gjl5Fz1UJEzL7k7JfrYGR4L2mgR3I9HGl8CCiTmupuSnBZxlgV0uh3HzrZgOXbn51gfSQLx++DvJdXE= X-MS-TrafficTypeDiagnostic: MWHPR12MB1310: X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1310;20:sqX/PVqGnav3JrN0Co/eRKWAFE2yBiwu6EaIJ820B3b3wAum/uKUPBQgxg2NwHnUGzQgF6dM9wrVuugVqZP5rTMH2GSF8qo5exfY/v18jnWwgn7WMZAyZIibcObyXo7lKEEDPWxSak0JLcaEwH8NM3M+PNSgfyqacaZUEMHeKzCC613QX2jki6DVNTIUcfwLwM9Ie902BnHBanWvNpYjdT9h3pW70AZmLkHHgheSlT1TkJ3abtJL2rg2sBVCS3jaaSimstx7v1Nhv9BzzHlVCT7Yzx4AXclZxcdas1pupCXa7+VhS2sK7KyRjCx80try1ESSUckXbznJYyJ7iMuiC2pdCdeSUexGaaVTUIUAxD+EQEAMqugd78p1C5wShfN/UOjBKMu682DQ7etsHCbXNcCf5FdK6zGuMlo9QGRRihAlgfOLmnGlRq4JqPV05SAA6gDivZZR30EvhQsOxtzw3JhBZf3u3pE3ZnbjGrsHAEHE0Pq1fhtptDr+knpVrZae;4:Jm9jkmlGmgNybC61VdV1Xl0cpbPYpaHPo1ujTBpOfkVGSOll+EQZ8175H8mAdaQoJT51RMUQblTxfecfbPL6myVBqyTo9W/D7zhtV8GGu1DBBltb8SdHThkXej45p6ijXzqjaDDgGYt4YMlwuR7kX1CUMfmMq6lXPiLNP6X0V7YLcmEOPSf4qGFMrIr649c/sMcsKG3JXzjpJz37PdH3d38FdNLmneEiqZNb759tdkjP1tJilrGMHdKDDuh18HGyp0Esj4AQBtK7kF9ahYPVtA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(5005006)(8121501046)(10201501046)(3231023)(2400080)(944501161)(93006095)(93001095)(3002001)(6055026)(6041268)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MWHPR12MB1310;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:MWHPR12MB1310; X-Forefront-PRVS: 0557CBAD84 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39860400002)(376002)(346002)(396003)(39380400002)(366004)(199004)(189003)(377424004)(51444003)(54906003)(53936002)(58126008)(83506002)(106356001)(86362001)(6666003)(6916009)(2950100002)(229853002)(67846002)(6246003)(8676002)(5660300001)(2906002)(65826007)(316002)(47776003)(6116002)(65806001)(65956001)(1706002)(36756003)(105586002)(93886005)(50466002)(68736007)(31696002)(386003)(59450400001)(305945005)(2486003)(52116002)(52146003)(23676004)(76176011)(2870700001)(478600001)(25786009)(31686004)(7736002)(6486002)(52396003)(81156014)(72206003)(4326008)(8936002)(81166006)(64126003)(97736004);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR12MB1310;H:[IPv6:2a02:908:1251:8fc0:4c6d:7233:b7e1:3b88];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjEyTUIxMzEwOzIzOmYxbmhxTU5PRGhRRnFzZ0VDWmdrWElVM2Ir?= =?utf-8?B?aGZVRnpvdG9SK3AxL0ZERjkyNUlkZkdRZEJZeVpOY2VyMW1PRnNrS3YrR1ZS?= =?utf-8?B?WUhPTDVxTDdwUWVFbHZsZFQwVG9WNTdJUFF1WGJZbUVXTGhGaVpacnhzUXly?= =?utf-8?B?YnhuTW8ySjNWMFo5dnJUMkJhMHUwZUlFN2VsVUpLM0hXL3hub2M5ZlBsdTEr?= =?utf-8?B?Q3BlVDlJWDZXQXA3VGYrNVhJMnB3VFpmT0liZHdSclRHVW41c2ttbVdTQ0pS?= =?utf-8?B?UHFJMGRKZGZHZFFPdG1GV2VNc3BpOHFqbk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6SYnSnLCM7WU9ZkJOCfSnQKHYoqSd6GKnYHu8UbzQ4L3WW/KvJ0fxv5vVzJeyJHY85q0xYjxv61SaOp++XFX1EQfb4Q/iW59q1xUVigqJK9mmJfitpjQz7rtfA7Zf48xfwc0PmStNU47K/PtLfovLwTZ3eyg=;5:+9sggyFSwsSqY2U9A+0qhk39bKj0zqrN/sjEcCO/W44AOsRsVYVLUVBe2Q9K4kUed4Pw2FRtpA84vAIhIJol0+uXS8270QZ2xYEhjhDWql1lyA2s20275SiWuScg6ha19ZtuJg0FlESWE1zqnQAsjfvNPBHG9OETtFfngr41cPo=;24:TWbsRs/nr9zl034vu/eyW/g76+PuFsPc8z8Tw7zimdHSkvYLDZydPXS85tuWbwQimamJa68vNXhJFFHQJk/vt9ud9bFh1gIJHmkY5zv1RBo=;7:KIBsTFxchM6i6RHQQQALIqnbX5Nwl/wjLeJxNUGddwNVVwOfQSEeAg8/tOz/rQkVLijJ22ViOZf3zIDJ0wSucL4Heg6wBrKyke83NyA/CjMdfyDbJPgkrrFShn/3qKe46BNLhDJ22y/3uTPg3txJzvZO2sat/9r+NB5px/FzCu4IWTO9clIG9L63DhuqtsCtNEWQaJYLZ5yPlOC4ZGGYE4M2oM0FJbRAoqBWOfzUps7EWUtLHS8xva1MlFRlAkNw SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1310;20:Xk5oxPZ5K43oL/ce7UmGkbrsYOuXT+2cfnLpy5+D/iBC2EJRH4qo8Vd/O5Ii//xG1jeh7rHFANRh364CX1z5yuc6eN5cY4749kipjkDmm96RgsJLUc8ooCS6o5kDcEb+OQmmoixDojOXeRCuXbKxiKsFL8zqOWoTh8zXXvlppC3w45ccg73qZvXF6CIlkCGRY1nz7US2d+Ue54ZuvRkZiPLTyBXkvo3QYrp0qZjnvmbuc9sTsAt4JLb08n8zmGce X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2018 16:54:49.2315 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28829c09-613d-4564-5ae8-08d55f5d5b63 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1310 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Would still require some changes in the fs layer, but I think that should be doable. Regards, Christian.