From: "Kumar, Kaushlendra" <kaushlendra.kumar@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: RE: [PATCH] tools/mm/thp_swap_allocator_test: Fix small folio alignment
Date: Thu, 18 Dec 2025 03:04:29 +0000 [thread overview]
Message-ID: <LV3PR11MB8768A0924C9336D1B32FD079F5A8A@LV3PR11MB8768.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20251215193123.1cd0bee80853599220a82ef1@linux-foundation.org>
On Tue, 9 Dec 2025, Andrew Morton wrote:
> On Tue, 9 Dec 2025 08:47:45 +0530 Kaushlendra Kumar wrote:
>> Use ALIGNMENT_SMALLFOLIO instead of ALIGNMENT_MTHP when allocating
>> small folios to ensure correct memory alignment for the test case.
>>
>> ...
>>
>> --- a/tools/mm/thp_swap_allocator_test.c
>> +++ b/tools/mm/thp_swap_allocator_test.c
>> @@ -142,7 +142,7 @@ int main(int argc, char *argv[])
>> }
>>
>> if (use_small_folio) {
>> - mem2 = aligned_alloc_mem(MEMSIZE_SMALLFOLIO, ALIGNMENT_MTHP);
>> + mem2 = aligned_alloc_mem(MEMSIZE_SMALLFOLIO, ALIGNMENT_SMALLFOLIO);
>> if (mem2 == NULL) {
>> fprintf(stderr, "Failed to allocate small folios memory\n");
>> free(mem1);
>
> What are the worst-case userspace visible runtime effects of this change?
Before: test allocates small folios with 64KB alignment (ALIGNMENT_MTHP) when
only 4KB alignment (ALIGNMENT_SMALLFOLIO) is needed. This wastes address space
and may cause allocation failures on systems with fragmented memory.
Worst-case impact: this only affects thp_swap_allocator_test tool behavior.
-Kaushlendra
prev parent reply other threads:[~2025-12-18 3:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-09 3:17 Kaushlendra Kumar
2025-12-16 3:31 ` Andrew Morton
2025-12-18 3:04 ` Kumar, Kaushlendra [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=LV3PR11MB8768A0924C9336D1B32FD079F5A8A@LV3PR11MB8768.namprd11.prod.outlook.com \
--to=kaushlendra.kumar@intel.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.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