[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250210150515.c71078f212ff4661eafc15bf@linux-foundation.org>
Date: Mon, 10 Feb 2025 15:05:15 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: David Hildenbrand <david@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linux-mm@...ck.org,
nouveau@...ts.freedesktop.org, linux-trace-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org, damon@...ts.linux.dev, Jérôme Glisse <jglisse@...hat.com>, Jonathan Corbet
<corbet@....net>, Alex Shi <alexs@...nel.org>, Yanteng Si
<si.yanteng@...ux.dev>, Karol Herbst <kherbst@...hat.com>, Lyude Paul
<lyude@...hat.com>, Danilo Krummrich <dakr@...nel.org>, David Airlie
<airlied@...il.com>, Simona Vetter <simona@...ll.ch>, Masami Hiramatsu
<mhiramat@...nel.org>, Oleg Nesterov <oleg@...hat.com>, Peter Zijlstra
<peterz@...radead.org>, SeongJae Park <sj@...nel.org>, "Liam R. Howlett"
<Liam.Howlett@...cle.com>, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>, Jann Horn <jannh@...gle.com>, Pasha
Tatashin <pasha.tatashin@...een.com>, Peter Xu <peterx@...hat.com>,
Alistair Popple <apopple@...dia.com>, Jason Gunthorpe <jgg@...dia.com>,
Barry Song <v-songbaohua@...o.com>
Subject: Re: [PATCH v2 00/17] mm: fixes for device-exclusive entries (hmm)
On Mon, 10 Feb 2025 20:37:42 +0100 David Hildenbrand <david@...hat.com> wrote:
> Against mm-hotfixes-stable for now.
>
> Discussing the PageTail() call in make_device_exclusive_range() with
> Willy, I recently discovered [1] that device-exclusive handling does
> not properly work with THP, making the hmm-tests selftests fail if THPs
> are enabled on the system.
>
> Looking into more details, I found that hugetlb is not properly fenced,
> and I realized that something that was bugging me for longer -- how
> device-exclusive entries interact with mapcounts -- completely breaks
> migration/swapout/split/hwpoison handling of these folios while they have
> device-exclusive PTEs.
>
> The program below can be used to allocate 1 GiB worth of pages and
> making them device-exclusive on a kernel with CONFIG_TEST_HMM.
>
> Once they are device-exclusive, these folios cannot get swapped out
> (proc$pid/smaps_rollup will always indicate 1 GiB RSS no matter how
> much one forces memory reclaim), and when having a memory block onlined
> to ZONE_MOVABLE, trying to offline it will loop forever and complain about
> failed migration of a page that should be movable.
>
> # echo offline > /sys/devices/system/memory/memory136/state
> # echo online_movable > /sys/devices/system/memory/memory136/state
> # ./hmm-swap &
> ... wait until everything is device-exclusive
> # echo offline > /sys/devices/system/memory/memory136/state
> [ 285.193431][T14882] page: refcount:2 mapcount:0 mapping:0000000000000000
> index:0x7f20671f7 pfn:0x442b6a
> [ 285.196618][T14882] memcg:ffff888179298000
> [ 285.198085][T14882] anon flags: 0x5fff0000002091c(referenced|uptodate|
> dirty|active|owner_2|swapbacked|node=1|zone=3|lastcpupid=0x7ff)
> [ 285.201734][T14882] raw: ...
> [ 285.204464][T14882] raw: ...
> [ 285.207196][T14882] page dumped because: migration failure
> [ 285.209072][T14882] page_owner tracks the page as allocated
> [ 285.210915][T14882] page last allocated via order 0, migratetype
> Movable, gfp_mask 0x140dca(GFP_HIGHUSER_MOVABLE|__GFP_COMP|__GFP_ZERO),
> id 14926, tgid 14926 (hmm-swap), ts 254506295376, free_ts 227402023774
> [ 285.216765][T14882] post_alloc_hook+0x197/0x1b0
> [ 285.218874][T14882] get_page_from_freelist+0x76e/0x3280
> [ 285.220864][T14882] __alloc_frozen_pages_noprof+0x38e/0x2740
> [ 285.223302][T14882] alloc_pages_mpol+0x1fc/0x540
> [ 285.225130][T14882] folio_alloc_mpol_noprof+0x36/0x340
> [ 285.227222][T14882] vma_alloc_folio_noprof+0xee/0x1a0
> [ 285.229074][T14882] __handle_mm_fault+0x2b38/0x56a0
> [ 285.230822][T14882] handle_mm_fault+0x368/0x9f0
> ...
>
> This series fixes all issues I found so far.
Cool.
Barry, could you please redo your series "mm: batched unmap lazyfree
large folios during reclamation" on top of this (on top of mm-unstable,
ideally).
Powered by blists - more mailing lists