Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3150079pxb; Tue, 20 Apr 2021 01:30:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUGV7k6ES4zL2qL74gSAc4M8reg5RrAX8AszPfr1nPw+SSJOMpFNScbHLn6psH+DBoCsqX X-Received: by 2002:a17:906:4ed1:: with SMTP id i17mr25732973ejv.424.1618907407851; Tue, 20 Apr 2021 01:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618907407; cv=none; d=google.com; s=arc-20160816; b=cNgjM/tV7H0HLj3Z3bmAC+o/1JasO6Y8T/+CTeptW+Sm6VE51kFoD4mEpfT1sbrEIC M1gFdXT9steo7xVVq2kytlgc02BQfH/2I9YBlAANHxDxj2mvlTqQHACtjXTHZb0j3h+i YNxYCkO/1jNnP0RSim8SOcGVbJxEv5WH0xIWAhMdEYNTBbKd2QZJe9NLO400ZBR/0Dhq FLQ0Z/1Mp+VeEXPCV9Wm0eHPid5Zu0Wv1QxlkU0TzaXujbO0Azb0GtQB5tuepbiggmzD UkWKZveyWyu8E7R6Dq5eikhdTuUhTv1SKXL8usudyovQKVWJt8JcREoOS2gILvgr4DU2 Ye0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Mr0hIV45HZyfj36zbs5xzzipJ3KnBhIuZDQPVZgMTZE=; b=jK8x+GKiridvfnMIPlOEXF7+D8keCzBZMSCW39NLuOu5128kL7ykYqZwqlHcIleBEX TORULvt0icgRoj0fEk7oEwxygZqhjda4prz/swhzW+l4vwAe5exB9D4jZaCS71n4+mGV TooPYR4bdCS12zoMjQjIU08wmlnCD2uO7hoevJdFFj0S/oxiFFNDEEl/eujX3qv0w7IW TKnbVjvoJADwxw7GXv4/OZGvrugkca8Byz/IC4Lfa4FljAuCrRx8rJX/O2E/r2bPaZA8 6ICpFM1OgQFAfI62uJbpyWO06rpxG1IN49gKl7j+VmMxbwjRlyhGowFry/rr/SAtHEf9 BrUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="dq/bpuXT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z26si16355646ejc.46.2021.04.20.01.29.43; Tue, 20 Apr 2021 01:30:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="dq/bpuXT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230018AbhDTI3U (ORCPT + 99 others); Tue, 20 Apr 2021 04:29:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:57058 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbhDTI3S (ORCPT ); Tue, 20 Apr 2021 04:29:18 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1618907326; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mr0hIV45HZyfj36zbs5xzzipJ3KnBhIuZDQPVZgMTZE=; b=dq/bpuXT3bF+hCrpYPqZY1xwAOCOUjyiFqC5wk/ykrf87PD9oZXdJAfr+mfXakUrhNKeMt 36N6tLpRSUQgs/pHahy7NAI1Ycx70QdxQ5+BettDyKUFcQEONkPD3i0F94AIfqxmBSm7Kl iAZWSVV+28ze1kQL3raW38q8lpiC7EQ= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8BA77ADDC; Tue, 20 Apr 2021 08:28:46 +0000 (UTC) Date: Tue, 20 Apr 2021 10:28:45 +0200 From: Michal Hocko To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Peter.Enderborg@sony.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, sumit.semwal@linaro.org, adobriyan@gmail.com, akpm@linux-foundation.org, songmuchun@bytedance.com, guro@fb.com, shakeelb@google.com, neilb@suse.de, samitolvanen@google.com, rppt@kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, willy@infradead.org Subject: Re: [PATCH v4] dma-buf: Add DmaBufTotal counter in meminfo Message-ID: References: <23aa041b-0e7c-6f82-5655-836899973d66@sony.com> <07ed1421-89f8-8845-b254-21730207c185@amd.com> <2d0e3c44-832b-f297-90da-e2c3280eff32@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2d0e3c44-832b-f297-90da-e2c3280eff32@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 20-04-21 10:00:07, Christian K?nig wrote: > Am 20.04.21 um 09:46 schrieb Michal Hocko: > > On Tue 20-04-21 09:32:14, Christian K?nig wrote: > > > Am 20.04.21 um 09:04 schrieb Michal Hocko: > > > > On Mon 19-04-21 18:37:13, Christian K?nig wrote: > > > > > Am 19.04.21 um 18:11 schrieb Michal Hocko: > > [...] > > > > What I am trying to bring up with NUMA side is that the same problem can > > > > happen on per-node basis. Let's say that some user consumes unexpectedly > > > > large amount of dma-buf on a certain node. This can lead to observable > > > > performance impact on anybody on allocating from that node and even > > > > worse cause an OOM for node bound consumers. How do I find out that it > > > > was dma-buf that has caused the problem? > > > Yes, that is the direction my thinking goes as well, but also even further. > > > > > > See DMA-buf is also used to share device local memory between processes as > > > well. In other words VRAM on graphics hardware. > > > > > > On my test system here I have 32GB of system memory and 16GB of VRAM. I can > > > use DMA-buf to allocate that 16GB of VRAM quite easily which then shows up > > > under /proc/meminfo as used memory. > > This is something that would be really interesting in the changelog. I > > mean the expected and extreme memory consumption of this memory. Ideally > > with some hints on what to do when the number is really high (e.g. mount > > debugfs and have a look here and there to check whether this is just too > > many users or an unexpected pattern to be reported). > > > > > But that isn't really system memory at all, it's just allocated device > > > memory. > > OK, that was not really clear to me. So this is not really accounted to > > MemTotal? > > It depends. In a lot of embedded systems you only have system memory and in > this case that value here is indeed really useful. > > > If that is really the case then reporting it into the oom > > report is completely pointless and I am not even sure /proc/meminfo is > > the right interface either. It would just add more confusion I am > > afraid. > > I kind of agree. As I said a DMA-buf could be backed by system memory or > device memory. > > In the case when it is backed by system memory it does make sense to report > this in an OOM dump. > > But only the exporting driver knows what the DMA-buf handle represents, the > framework just provides the common ground for inter driver communication. Then those drivers need to account for meminfo/oom report purposes. > > > > See where I am heading? > > > Yeah, totally. Thanks for pointing this out. > > > > > > Suggestions how to handle that? > > As I've pointed out in previous reply we do have an API to account per > > node memory but now that you have brought up that this is not something > > we account as a regular memory then this doesn't really fit into that > > model. But maybe I am just confused. > > Well does that API also has a counter for memory used by device drivers? I think that "memory used by device drivers" is immaterial. The only important thing is to account that memory where it makes sense. So for RAM based allocations to report them via meminfo and find other way to report device memory allocations. -- Michal Hocko SUSE Labs