linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Patryk Kowalczyk <patryk@kowalczyk.ws>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: "Hugh Dickins" <hughd@google.com>,
	"David Hildenbrand" <david@redhat.com>,
	da.gomez@samsung.com, baohua@kernel.org,
	wangkefeng.wang@huawei.com, ioworker0@gmail.com,
	willy@infradead.org, ryan.roberts@arm.com,
	akpm@linux-foundation.org, eero.t.tamminen@intel.com,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: regression - mm: shmem: add large folio support for tmpfs affect GPU performance.
Date: Fri, 25 Jul 2025 10:36:00 +0200	[thread overview]
Message-ID: <CAJCW39JmaJpFCgoSGf6tSYkwVgxyUdSDFeeoFmf6ODLfsh4Cag@mail.gmail.com> (raw)
In-Reply-To: <0c9dc2fa-34c9-4db5-bea3-af4caf05ee6b@linux.alibaba.com>

[-- Attachment #1: Type: text/plain, Size: 3211 bytes --]

I have tested the fix for the i915 driver with kernel 6.16-rc7 and intel
core ultra 155H.
The performance in several tests is on the kernel 6.12 level,
so from a functional standpoint, the issue has been resolved.
Additionally, I also see potential for further optimization of the Xe
driver.

regards,
Patryk
pt., 25 lip 2025 o 08:05 Baolin Wang <baolin.wang@linux.alibaba.com>
napisał(a):

>
>
> On 2025/7/25 12:47, Hugh Dickins wrote:
> > On Fri, 25 Jul 2025, Baolin Wang wrote:
> >>>
> >>> I hope to correct the logic of i915 driver's shmem allocation, by
> extending
> >>> the shmem write length in the i915 driver to allocate PMD- sized THPs.
> IIUC,
> >>> some sample fix code is as follows (untested). Patryk, could you help
> test
> >>> it to see if this resolves your issue? Thanks.
> >
> > This patch cannot be the right fix.  It may be a very sensible workaround
> > for some in-kernel drivers (I've not looked or tried); but unless I
> > misunderstand, it does nothing to restore userspace behaviour on a
> > huge=always tmpfs.
>
> Yes. Initially, we wanted to maintain compatibility with the 'huge='
> option, meaning that 'huge=always' tmpfs mount would still allocate
> PMD-sized THPs. However, the current implementation is the consensus we
> reached after much debate:
>
> 1. “When using tmpfs as a filesystem, it should behave like other
> filesystems. No more special mount options.” Per Matthew.
> 2. “Do not let the 'huge=' mount option mean 'PMD-sized' when other
> sizes exist.” Per David.
>
> At the time, we should have sought your advice, but we failed. The long
> historical discussion is in this thread[1]. So now the strategy for
> tmpfs supporting large folios is:
>
> "
> Considering that tmpfs already has the 'huge=' option to control the
> PMD-sized large folios allocation, we can extend the 'huge=' option to
> allow any sized large folios. The semantics of the 'huge=' mount option
> are:
> huge=never: no any sized large folios
> huge=always: any sized large folios
> huge=within_size: like 'always' but respect i_size
> huge=advise: like 'always' if requested with madvise()
>
> Note: For tmpfs mmap() faults, due to the lack of a write size hint,
> still allocate the PMD-sized large folios if
> huge=always/within_size/advise is set.
>
> Moreover, the 'deny' and 'force' testing options controlled by
> '/sys/kernel/mm/transparent_hugepage/shmem_enabled' still retain the
> same semantics. The 'deny' can disable any sized large folios for tmpfs,
> while the 'force' can enable PMD sized large folios for tmpfs.
> "
>
> Currently, we have observed regression in the i915 driver but have not
> yet seen userspace regression on a huge=always tmpfs.
>
> If you have better suggestions, please feel free to point them out. Thanks.
>
> [1] https://lore.kernel.org/lkml/Zw_IT136rxW_KuhU@casper.infradead.org/
>
> > Please reread my comment earlier in the thread, in particular,
> > Passing a new SIGBUS xfstest does not excuse a regression: strict
> PAGE_SIZE
> > SIGBUS behaviour is fine for the newly-featured mTHPs or large folios,
> > but not for the long-established huge=always.
>
>

[-- Attachment #2: Type: text/html, Size: 4042 bytes --]

  reply	other threads:[~2025-07-25  8:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAJCW39JCDX6_S2Ojt1HMmX-h_qAKm2eBRzxX5kOHNJz60Zu=vw@mail.gmail.com>
     [not found] ` <d5c6ac93-1af0-4093-afea-94a29a387903@redhat.com>
     [not found]   ` <63b69425-2fd1-2c77-06d6-e7ea25c92f34@google.com>
     [not found]     ` <3f204974-26c8-4d5f-b7ae-4052cbfdf4ac@redhat.com>
     [not found]       ` <a8ac7ec3-4cb3-4dd8-8d02-ede6905f322e@linux.alibaba.com>
2025-07-25  2:38         ` Baolin Wang
2025-07-25  4:47           ` Hugh Dickins
2025-07-25  6:05             ` Baolin Wang
2025-07-25  8:36               ` Patryk Kowalczyk [this message]
2025-07-25  9:17                 ` Baolin Wang
2025-07-28  5:35               ` Hugh Dickins
2025-07-28  6:29                 ` Baolin Wang

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=CAJCW39JmaJpFCgoSGf6tSYkwVgxyUdSDFeeoFmf6ODLfsh4Cag@mail.gmail.com \
    --to=patryk@kowalczyk.ws \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=da.gomez@samsung.com \
    --cc=david@redhat.com \
    --cc=eero.t.tamminen@intel.com \
    --cc=hughd@google.com \
    --cc=ioworker0@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=ryan.roberts@arm.com \
    --cc=ville.syrjala@linux.intel.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    /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