public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: "Michel Dänzer" <michel.daenzer@mailbox.org>,
	"Thadeu Lima de Souza Cascardo" <cascardo@igalia.com>
Cc: Huang Rui <ray.huang@amd.com>,
	Matthew Auld <matthew.auld@intel.com>,
	Matthew Brost <matthew.brost@intel.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	kernel-dev@igalia.com,
	Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: Re: [PATCH] drm: ttm: do not direct reclaim when allocating high order pages
Date: Thu, 11 Sep 2025 18:09:52 +0200	[thread overview]
Message-ID: <66061cfd-d2b2-4254-95ab-891fa2017194@amd.com> (raw)
In-Reply-To: <979f8223-68b0-4a75-b410-fd86cfe6c372@mailbox.org>

On 11.09.25 16:48, Michel Dänzer wrote:
> On 11.09.25 16:31, Christian König wrote:
>> On 11.09.25 14:49, Michel Dänzer wrote:
>>>>>> What we are seeing here is on a low memory (4GiB) single node system with
>>>>>> an APU, that it will have lots of latencies trying to allocate memory by
>>>>>> doing direct reclaim trying to allocate order-10 pages, which will fail and
>>>>>> down it goes until it gets to order-4 or order-3. With this change, we
>>>>>> don't see those latencies anymore and memory pressure goes down as well.
>>>>> That reminds me of the scenario I described in the 00862edba135 ("drm/ttm: Use GFP_TRANSHUGE_LIGHT for allocating huge pages") commit log, where taking a filesystem backup could cause Firefox to freeze for on the order of a minute.
>>>>>
>>>>> Something like that can't just be ignored as "not a problem" for a potential 30% performance gain.
>>>>
>>>> Well using 2MiB is actually a must have for certain HW features and we have quite a lot of people pushing to always using them.
>>>
>>> Latency can't just be ignored though. Interactive apps intermittently freezing because this code desperately tries to reclaim huge pages while the system is under memory pressure isn't acceptable.
>>
>> Why should that not be acceptable?
> 
> Sounds like you didn't read / understand the scenario in the 00862edba135 commit log:
> 
> I was trying to use Firefox while restic was taking a filesystem backup, and it froze for up to a minute. After disabling direct reclaim, Firefox was perfectly usable without noticeable freezes in the same scenario.
> 
> Show me the user who finds it acceptable to wait for a minute for interactive apps to respond, just in case some GPU operations might be 30% faster.

Ok granted, a minute is rather extreme. But IIRC the issue you described was solved by using __GFP_NORETRY, that here is about completely disabling direct reclaim.

As far as I know with __GFP_NORETRY set the direct reclaim path results in latency in the milliseconds range.

The key point is we tried to completely disable direct reclaim before and that made the datacenter customers scream out because now the performance was totally unstable.

E.g. something like compiling software first and then running a benchmark was like 30% slower than running the benchmark directly after boot.

Regards,
Christian.

      reply	other threads:[~2025-09-11 16:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-10 11:59 [PATCH] drm: ttm: do not direct reclaim when allocating high order pages Thadeu Lima de Souza Cascardo
2025-09-10 12:11 ` Christian König
2025-09-10 12:52   ` Thadeu Lima de Souza Cascardo
2025-09-10 13:34     ` Christian König
2025-09-11  8:26     ` Michel Dänzer
2025-09-11  9:07       ` Christian König
2025-09-11 12:49         ` Michel Dänzer
2025-09-11 14:31           ` Christian König
2025-09-11 14:48             ` Michel Dänzer
2025-09-11 16:09               ` Christian König [this message]

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=66061cfd-d2b2-4254-95ab-891fa2017194@amd.com \
    --to=christian.koenig@amd.com \
    --cc=airlied@gmail.com \
    --cc=cascardo@igalia.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-dev@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=michel.daenzer@mailbox.org \
    --cc=mripard@kernel.org \
    --cc=ray.huang@amd.com \
    --cc=senozhatsky@chromium.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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