From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Vineet Agarwal <agarwal.vineet2006@gmail.com>
Cc: akpm@linux-foundation.org, ljs@kernel.org, shuah@kernel.org,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] selftests/mm: khugepaged: initialize file contents via mmap
Date: Tue, 28 Apr 2026 12:06:14 +0200 [thread overview]
Message-ID: <7f729e75-dd66-49ea-ab5f-408fdc1a5c81@kernel.org> (raw)
In-Reply-To: <CA+rjy8dFQiqwiGT3Aa-=-ZaHDzeT_87ohEb7ti=Z-DxX2FvTPw@mail.gmail.com>
On 4/28/26 11:52, Vineet Agarwal wrote:
> ftruncate() is needed before mmap(), since the file is created with
> O_TRUNC and initially has size 0. Without resizing it first, mapping
> and accessing the full range can go beyond EOF.
Ah, that makes sense, worth spelling it out. Indeed, we otherwise get
$ sudo ./khugepaged madvise:file .
Save THP and khugepaged settings... OK
Allocate huge page on fault... OK
Split huge PMD on MADV_DONTNEED... OK
Run test: collapse_full (madvise:file)
Creating ./collapse_test_file for collapse...Bus error
--
Cheers,
David
next prev parent reply other threads:[~2026-04-28 10:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 6:23 [PATCH] selftests/mm: khugepaged: handle partial write in file_setup_area() Vineet Agarwal
2026-04-28 8:04 ` David Hildenbrand (Arm)
2026-04-28 9:15 ` Vineet Agarwal
2026-04-28 9:43 ` [PATCH v2] selftests/mm: khugepaged: initialize file contents via mmap Vineet Agarwal
2026-04-28 9:46 ` David Hildenbrand (Arm)
2026-04-28 9:52 ` Vineet Agarwal
2026-04-28 10:06 ` David Hildenbrand (Arm) [this message]
2026-04-28 10:00 ` [PATCH v3] " Vineet Agarwal
2026-04-28 10:07 ` David Hildenbrand (Arm)
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=7f729e75-dd66-49ea-ab5f-408fdc1a5c81@kernel.org \
--to=david@kernel.org \
--cc=agarwal.vineet2006@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=shuah@kernel.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