From: SeongJae Park <sj@kernel.org>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: SeongJae Park <sj@kernel.org>,
David Hildenbrand <david@redhat.com>,
Usama Arif <usamaarif642@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, hannes@cmpxchg.org, shakeel.butt@linux.dev,
riel@surriel.com, ziy@nvidia.com, laoar.shao@gmail.com,
baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com,
npache@redhat.com, ryan.roberts@arm.com,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
kernel-team@meta.com
Subject: Re: Is number of process_madvise()-able ranges limited to 8? (was Re: [PATCH 1/6] prctl: introduce PR_THP_POLICY_DEFAULT_HUGE for the process)
Date: Sat, 17 May 2025 13:25:26 -0700 [thread overview]
Message-ID: <20250517202526.39730-1-sj@kernel.org> (raw)
In-Reply-To: <005161f7-d849-41a9-8350-f56e52c49e7e@lucifer.local>
On Sat, 17 May 2025 19:50:34 +0100 Lorenzo Stoakes <lorenzo.stoakes@oracle.com> wrote:
[...]
> Let's keep this simple - I'm just wrong here :) apologies, entirely my
> fault.
No worry, appreciate your kind and detailed answer.
[...]
> Anyway, let's dig into the code to get things right:
[...]
> So - this confirms it - we're fine, it just tries to use the stack-based
> array if it can - otherwise it kmalloc()'s.
>
> Of course, UIO_MAXIOV remains the _actual_ hard limit (hardcoded to 1,024
> in include/uapi/linux/uio.h).
Thanks for kind clarifications. All your explanations perfectly matches with
my understanding. I'm happy to be on the same page with you!
>
> The other points I made about the proposed interface remain, but I won't go
> into more detail as we are obviously lacking that context here.
>
> Thanks for bringing this up and correcting my misinterpretation, as well as
> providing the below repro code, and let's revisit your old series... but on
> Monday :)
Sure, and no worry, take your time :)
>
> I should really not be looking at work mail on a Saturday (mea culpa, once
> again... :)
I hope your remaining weekend be calm and uninterruptable. Keeping you not
burned out is important for the community :)
>
> One small nit in the repro code below (hey I'm a kernel dev, can't help
> myself... ;)
To me, being a kernel programmer rather than a user-space c code programmer is
a good excuse for asking to be generous to my user-space bugs ;) Thank you for
your kind comment below, anyway :)
>
> Cheers, Lorenzo
>
> >
> > Attaching my test code below. You could simply run it as below.
> >
> > gcc test.c && ./a.out
> >
> > ==== Attachment 0 (test.c) ====
[...]
> > ret = syscall(SYS_process_madvise, pidfd, vec, NR_PAGES,
> > MADV_DONTNEED, 0);
> > if (ret != MMAP_SZ) {
> > printf("process_madvise fail\n");
> > return -1;
> > }
>
> To be pedantic, you are really only checking to see if an error was
> returned, in theory no error might have been returned but the operation
> might have not proceeded, so a more proper check here would be to populated
> the anon memory with non-zero data, then check afterwards that it's zeroed.
>
> Given this outcome would probably imply iovec issues, it's not likely, but
> to really assert the point you'd probably want to do that!
Good points! I once considered making this test better and posting to be
included in mm selftests, but found no time to do that so far. Above input
must be very helpful in a case that I (or someone else) find a time to write
such process_madvise() selftest.
Thanks,
SJ
[...]
next prev parent reply other threads:[~2025-05-17 20:25 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 13:33 [PATCH 0/6] prctl: introduce PR_SET/GET_THP_POLICY Usama Arif
2025-05-15 13:33 ` [PATCH 1/6] prctl: introduce PR_THP_POLICY_DEFAULT_HUGE for the process Usama Arif
2025-05-15 14:40 ` Lorenzo Stoakes
2025-05-15 14:44 ` David Hildenbrand
2025-05-15 14:56 ` Usama Arif
2025-05-15 14:58 ` David Hildenbrand
2025-05-15 15:18 ` Lorenzo Stoakes
2025-05-15 15:45 ` Liam R. Howlett
2025-05-15 15:57 ` David Hildenbrand
2025-05-15 16:38 ` Lorenzo Stoakes
2025-05-15 17:29 ` David Hildenbrand
2025-05-15 18:09 ` Liam R. Howlett
2025-05-15 18:21 ` Lorenzo Stoakes
2025-05-15 18:42 ` Zi Yan
2025-05-15 21:04 ` Lorenzo Stoakes
2025-05-15 18:46 ` Usama Arif
2025-05-15 19:20 ` David Hildenbrand
2025-05-15 15:28 ` Usama Arif
2025-05-15 16:06 ` Lorenzo Stoakes
2025-05-15 16:11 ` David Hildenbrand
2025-05-15 18:08 ` Lorenzo Stoakes
2025-05-15 19:12 ` David Hildenbrand
2025-05-15 20:35 ` Lorenzo Stoakes
2025-05-16 7:45 ` David Hildenbrand
2025-05-16 10:57 ` Lorenzo Stoakes
2025-05-16 11:24 ` David Hildenbrand
2025-05-16 12:57 ` Lorenzo Stoakes
2025-05-16 17:19 ` Usama Arif
2025-05-16 17:51 ` Lorenzo Stoakes
2025-05-16 19:34 ` Usama Arif
2025-05-17 16:20 ` Is number of process_madvise()-able ranges limited to 8? (was Re: [PATCH 1/6] prctl: introduce PR_THP_POLICY_DEFAULT_HUGE for the process) SeongJae Park
2025-05-17 18:50 ` Lorenzo Stoakes
2025-05-17 20:25 ` SeongJae Park [this message]
2025-05-17 19:01 ` [PATCH 1/6] prctl: introduce PR_THP_POLICY_DEFAULT_HUGE for the process Lorenzo Stoakes
2025-05-15 16:47 ` Usama Arif
2025-05-15 18:36 ` Lorenzo Stoakes
2025-05-15 19:17 ` David Hildenbrand
2025-05-15 20:42 ` Lorenzo Stoakes
2025-05-16 6:12 ` kernel test robot
2025-05-15 13:33 ` [PATCH 2/6] prctl: introduce PR_THP_POLICY_DEFAULT_NOHUGE " Usama Arif
2025-05-16 8:19 ` kernel test robot
2025-05-15 13:33 ` [PATCH 3/6] prctl: introduce PR_THP_POLICY_SYSTEM " Usama Arif
2025-05-15 13:33 ` [PATCH 4/6] selftests: prctl: introduce tests for PR_THP_POLICY_DEFAULT_NOHUGE Usama Arif
2025-05-15 13:33 ` [PATCH 5/6] selftests: prctl: introduce tests for PR_THP_POLICY_DEFAULT_HUGE Usama Arif
2025-05-15 13:33 ` [PATCH 6/6] docs: transhuge: document process level THP controls Usama Arif
2025-05-15 13:55 ` [PATCH 0/6] prctl: introduce PR_SET/GET_THP_POLICY Lorenzo Stoakes
2025-05-15 14:50 ` Usama Arif
2025-05-15 15:15 ` Lorenzo Stoakes
2025-05-15 15:54 ` Usama Arif
2025-05-15 16:04 ` David Hildenbrand
2025-05-15 16:24 ` Lorenzo Stoakes
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=20250517202526.39730-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@meta.com \
--cc=laoar.shao@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=npache@redhat.com \
--cc=riel@surriel.com \
--cc=ryan.roberts@arm.com \
--cc=shakeel.butt@linux.dev \
--cc=usamaarif642@gmail.com \
--cc=ziy@nvidia.com \
/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;
as well as URLs for NNTP newsgroup(s).