Received: by 10.223.176.46 with SMTP id f43csp694343wra; Fri, 19 Jan 2018 00:19:46 -0800 (PST) X-Google-Smtp-Source: ACJfBovjU8rMndB39R+KPnL1E4QxR2Gm6VmRT8Wp/5rJLWksOaV+Tt4MqiBFsbcNhGo8mYTJrzLv X-Received: by 10.101.100.19 with SMTP id a19mr31621648pgv.203.1516349986265; Fri, 19 Jan 2018 00:19:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516349986; cv=none; d=google.com; s=arc-20160816; b=OCZAeMU7F9Y1NwsK5wSzYKC2AiVMBt+TLO7urF2SvN3ZeU2XdXq1V0FgKyMY7jVSS/ yeCcOacil/olU6w11gZX+DE/F4v/YvqrYiD/PYRuKtmKo7ZRA7v6zjpw4vc12zhv87YQ tEVTNXp5pYlgMk51dZ/BUm3vM1rLahOibD49tIZz4V+mTdrmnWbOb6r+sdLG4olUrkLQ GmO7fqGbU5FVKDHcDlARX+YyU3u/63VwVLFMoNAHBlJmBteWntvNhU0ExXAWtYvKWHCY NAzxItSgTcl0xnAxWQoQbTxvH7dEaKLBIYl1xDWtagVVVqbQp8G9kdu5olBqxBJF82RQ hM2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to:dkim-signature :arc-authentication-results; bh=99dyvvFBP/f7EWZefGrn6JAmLq59N9eCn9rs4IP4hxw=; b=ij6o7f3CCtavskP8FYXK0dhPEqeS2kxO21H/AhCEdMv7KQ0g6bLw+stmgqJK3Aa98N V/NHeE9XB3fTlAGhNbyOoPzETUitYZf26MinbdiwiWWyp/nD+ioHoT6X3E8IhuOpXtqC 8NpEcl7CCrpyK/UBiit9yiwPl+pXYHHJRk9q03uDwHoJSq4wnGDPfWy4QS4ekr/YXsp0 vabjIHMmVRNEl7a+WrFd1NrUGwYCWtL4wuY96oPdauwP6yHP5mS/daeV08/ywXnGQt6K 2LvablgxCHLvqCUI8PLAZrWK135E1DY9W6VlaRyKzWZHkbIYgPMbgjKpSobcBZopM4Jj MAIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YwM3Sz77; 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 m3-v6si646755plb.330.2018.01.19.00.19.31; Fri, 19 Jan 2018 00:19:46 -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=YwM3Sz77; 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 S1754805AbeASISA (ORCPT + 99 others); Fri, 19 Jan 2018 03:18:00 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:40124 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753529AbeASIRy (ORCPT ); Fri, 19 Jan 2018 03:17:54 -0500 Received: by mail-wm0-f45.google.com with SMTP id v123so1729299wmd.5 for ; Fri, 19 Jan 2018 00:17:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=reply-to:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=99dyvvFBP/f7EWZefGrn6JAmLq59N9eCn9rs4IP4hxw=; b=YwM3Sz77GtoZLIBVT/6Kp+aKZzbMFgGd2M26iJ1+wCra0+TnvQlQAldNEgbOATI30N r0pG3ULtOVt+EkbfEvepvp2eg80sh9kXb04TOIYYJ0PC9UNBmb3z5nnk7t6p8KJSEAUk roGcv8lyU/f+v9Isfyl+qo3y1+2K8k1OYKGil9SHVfKSU44WHwEpnAuG6XvvQedQzPHp 5yi8TBukycrEAXc9gsbph3eay40Y+OqagmjSx42K0TeS2odps8fC8PAQbziBpyIYxdbd Bcwb0Pqg5hxtVp11iHs6D9j9TwBUXqPwLb5JSwhU/blMvKKZipyMFYL4oO/+W57fOsaU YoRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=99dyvvFBP/f7EWZefGrn6JAmLq59N9eCn9rs4IP4hxw=; b=LAjdN+jrAGmlAKLWJoRO72LZrbeIxt3RUJqUkuQkiIrKjihBExuHnrhqGbqyj7R9H1 QZsl/32ChmyJTJw2d+ykM/M4SSuDuAsWrGS3XFD7OMl15kLer6Nq2HLj3UHFN1K2Cbrq zf/iqDKPsyDSokz1rxbKT1tDEvbK5U3GgUdT6ssDziSgWv6YocDazKG7hjkHbdGRU8HZ ArCvxvQFGmlc6a3B2eQd12BqCZrY1ip8NjeBx3GoqRsTrK/mlB+fvvZ1cdmFF3WZLoDt kvcXykC0Ix3LP/NlXg24TMp4dQ33uVabuvDmWud/PvOMXKhcLfd76ysDOdoNtUZXun9/ DwIA== X-Gm-Message-State: AKwxytcUD4QqX5DTJ21xecGS4oxuLafQkvfmXqqRLQ4/ynxB2sg4KEm1 d5aVtiqxnB0hS8iP5z+hrQmVl9ZI X-Received: by 10.80.144.132 with SMTP id c4mr11712373eda.13.1516349872894; Fri, 19 Jan 2018 00:17:52 -0800 (PST) Received: from ?IPv6:2a02:908:1251:8fc0:4c6d:7233:b7e1:3b88? ([2a02:908:1251:8fc0:4c6d:7233:b7e1:3b88]) by smtp.gmail.com with ESMTPSA id q6sm5643221edb.85.2018.01.19.00.17.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jan 2018 00:17:52 -0800 (PST) Reply-To: christian.koenig@amd.com Subject: Re: [RFC] Per file OOM badness To: "He, Roger" , "Grodzovsky, Andrey" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "dri-devel@lists.freedesktop.org" , "amd-gfx@lists.freedesktop.org" Cc: "Koenig, Christian" References: <1516294072-17841-1-git-send-email-andrey.grodzovsky@amd.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <78121ca2-3693-d43e-5a5f-989380fb3667@gmail.com> Date: Fri, 19 Jan 2018 09:17:51 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 19.01.2018 um 06:39 schrieb He, Roger: > Basically the idea is right to me. > > 1. But we need smaller granularity to control the contribution to OOM badness. > Because when the TTM buffer resides in VRAM rather than evict to system memory, we should not take this account into badness. > But I think it is not easy to implement. I was considering that as well when I wrote the original patch set, but then decided against it at least for now. Basically all VRAM buffers can be swapped to system memory, so they potentially need system memory as well. That is especially important during suspend/resume. > > 2. If the TTM buffer(GTT here) is mapped to user for CPU access, not quite sure the buffer size is already taken into account for kernel. > If yes, at last the size will be counted again by your patches. No that isn't accounted for as far as I know. > > So, I am thinking if we can counted the TTM buffer size into: > struct mm_rss_stat { > atomic_long_t count[NR_MM_COUNTERS]; > }; > Which is done by kernel based on CPU VM (page table). > > Something like that: > When GTT allocate suceess: > add_mm_counter(vma->vm_mm, MM_ANONPAGES, buffer_size); > > When GTT swapped out: > dec_mm_counter from MM_ANONPAGES frist, then > add_mm_counter(vma->vm_mm, MM_SWAPENTS, buffer_size); // or MM_SHMEMPAGES or add new item. > > Update the corresponding item in mm_rss_stat always. > If that, we can control the status update accurately. > What do you think about that? > And is there any side-effect for this approach? I already tried this when I originally worked on the issue and that approach didn't worked because allocated buffers are not associated to the process where they are created. E.g. most display surfaces are created by the X server, but used by processes. So if you account the BO to the process who created it we would start to kill X again and that is exactly what we try to avoid. Regards, Christian. > > > Thanks > Roger(Hongbo.He) > > -----Original Message----- > From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On Behalf Of Andrey Grodzovsky > Sent: Friday, January 19, 2018 12:48 AM > To: linux-kernel@vger.kernel.org; linux-mm@kvack.org; dri-devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org > Cc: Koenig, Christian > Subject: [RFC] Per file OOM badness > > Hi, this series is a revised version of an RFC sent by Christian König a few years ago. The original RFC can be found at https://lists.freedesktop.org/archives/dri-devel/2015-September/089778.html > > This is the same idea and I've just adressed his concern from the original RFC and switched to a callback into file_ops instead of a new member in struct file. > > Thanks, > Andrey > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx