public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Kenneth Crudup <kenny@panix.com>
Cc: <intel-xe@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>,
	Christian Koenig <christian.koenig@amd.com>,
	Huang Rui <ray.huang@amd.com>,
	Matthew Auld <matthew.auld@intel.com>,
	David Airlie <airlied@gmail.com>
Subject: Re: [PATCH] drm/ttm: Fix GPU MM stats during pool shrinking
Date: Fri, 1 May 2026 21:12:31 -0700	[thread overview]
Message-ID: <afV5r9PpyAimOQmV@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <18c48e7f-a2bd-4e74-9262-266cd5c2fde8@panix.com>

On Fri, May 01, 2026 at 05:05:14PM -0700, Kenneth Crudup wrote:
> 
> On 5/1/26 15:30, Matthew Brost wrote:
> 
> > TTM pool shrinking frees pages by calling __free_pages() directly,
> > which bypasses updates to NR_GPU_ACTIVE and leaves GPU MM accounting
> > out of sync.
> > 
> > Introduce a helper, __free_pages_gpu_account(), and use it for all page
> > frees in ttm_pool.c so GPU MM statistics are updated consistently.
> 
> OK, so why/how does "bonnie++" increase the GPU Memory size?
> 

Well, it shouldn’t. What bonnie++ does is basically consume system
memory, triggering reclaim, which in turn will evict GPU BOs that exist
when the display is open. Thanks for pointing me to bonnie++ - this,
plus running something like the WebGL Aquarium in Chrome, is a very nice
test case for Xe/DRM shrinkers.

> ----
> SwapTotal:      33554428 kB
> MemTotal:       32345672 kB
> GPUReclaim:       621568 kB
> GPUActive:        453592 kB
> 
> SwapTotal:      33554428 kB
> MemTotal:       32345672 kB
> GPUActive:       5554976 kB
> GPUReclaim:        12716 kB
> 
> SwapTotal:      33554428 kB
> MemTotal:       32345672 kB
> GPUActive:      18407272 kB
> GPUReclaim:          884 kB
> 
> SwapTotal:      33554428 kB
> MemTotal:       32345672 kB
> GPUActive:      24022916 kB
> GPUReclaim:          716 kB
> 
> SwapTotal:      33554428 kB
> MemTotal:       32345672 kB
> GPUActive:      25258248 kB
> GPUReclaim:        16032 kB
> 
> SwapTotal:      33554428 kB
> MemTotal:       32345672 kB
> GPUActive:      28207188 kB
> GPUReclaim:         3684 kB
> ----
> 
> ... and I'm now not so sure the patch is working ... this after a 2nd bonnie
> run:

It doesn’t appear that it is. I can recreate what you’re seeing with
this patch alone on drm-tip. I originally coded this patch on top of a
local fix to avoid the TTM shrinker allocating higher-order folios when
reclaiming memory—this is working there. I falsely assumed it would work
on drm-tip as well. Let me ensure I have a standalone fix for GPUActive
accounting first, then apply my TTM shrinker fix on top.

Matt

> 
> ----
> GPUActive:      44357100 kB
> SwapTotal:      33554428 kB
> MemTotal:       32345672 kB
> GPUReclaim:        94864 kB
> 
> GPUActive:      44373904 kB
> SwapTotal:      33554428 kB
> MemTotal:       32345672 kB
> GPUReclaim:        94996 kB
> 
> GPUActive:      44354940 kB
> SwapTotal:      33554428 kB
> MemTotal:       32345672 kB
> GPUReclaim:        98048 kB
> 
> GPUActive:      44769340 kB
> SwapTotal:      33554428 kB
> MemTotal:       32345672 kB
> GPUReclaim:       122996 kB
> ----
> 
> -Kenny
> 
> -- 
> Kenneth R. Crudup / Sr. SW Engineer, Scott County Consulting, Orange County
> CA
> 

  reply	other threads:[~2026-05-02  4:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01 22:30 [PATCH] drm/ttm: Fix GPU MM stats during pool shrinking Matthew Brost
2026-05-01 22:36 ` ✗ CI.checkpatch: warning for " Patchwork
2026-05-01 22:37 ` ✓ CI.KUnit: success " Patchwork
2026-05-01 22:57 ` [PATCH] " Kenneth Crudup
2026-05-01 23:28 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-05-02  0:05 ` [PATCH] " Kenneth Crudup
2026-05-02  4:12   ` Matthew Brost [this message]
2026-05-02  4:13     ` Matthew Brost
2026-05-02  0:48 ` ✗ Xe.CI.FULL: failure for " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=afV5r9PpyAimOQmV@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=airlied@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=kenny@panix.com \
    --cc=matthew.auld@intel.com \
    --cc=ray.huang@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox