From: Jason Gunthorpe <jgg@nvidia.com>
To: Nicolin Chen <nicolinc@nvidia.com>
Cc: kevin.tian@intel.com, shuah@kernel.org,
joao.m.martins@oracle.com, steven.sistare@oracle.com,
iommu@lists.linux.dev, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, thomas.weissschuh@linutronix.de
Subject: Re: [PATCH rc 1/4] iommufd/selftest: Fix iommufd_dirty_tracking with large hugepage sizes
Date: Wed, 18 Jun 2025 08:38:50 -0300 [thread overview]
Message-ID: <20250618113850.GE1575786@nvidia.com> (raw)
In-Reply-To: <aFH+cUSi1GITvF3F@nvidia.com>
On Tue, Jun 17, 2025 at 04:46:57PM -0700, Nicolin Chen wrote:
> On Tue, Jun 17, 2025 at 08:01:36PM -0300, Jason Gunthorpe wrote:
> > On Tue, Jun 17, 2025 at 02:23:41PM -0700, Nicolin Chen wrote:
> > > On Tue, Jun 17, 2025 at 08:59:48AM -0300, Jason Gunthorpe wrote:
> > > > On Mon, Jun 16, 2025 at 07:02:08PM -0700, Nicolin Chen wrote:
> > > > > ---breakdown---
> > > > > After `posix_memalign()`:
> > > > > [ posix_memalign() memory ] ← malloc thinks it owns this
> > > > >
> > > > > Then `mmap(aligned_ptr, ..., MAP_FIXED)`:
> > > > > [ anonymous mmap region ] ← malloc still thinks it owns this (!)
> > > > > ↑ mapped
> > > > > ---end---
> > > >
> > > > Yes, this is correct and what we are doing here. The allocator always
> > > > owns it and we are just replacing the memory with a different mmap.
> > >
> > > Hmm, if allocator always owns it. Does that mean the munmap() [3]
> > > will release what [1] and [2] do (allocating and replacing)?
> >
> > No, munmap doesn't destroy the allocator meta data.
>
> Should we do something to that meta data?
My patch calls free on it which removes the metadata and might munmap
the range (or re-use it, but that doesn't matter)
Jason
next prev parent reply other threads:[~2025-06-18 11:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-16 5:02 [PATCH rc 0/4] Fix iommufd selftest FAIL and warnings with v6.16 Nicolin Chen
2025-06-16 5:02 ` [PATCH rc 1/4] iommufd/selftest: Fix iommufd_dirty_tracking with large hugepage sizes Nicolin Chen
2025-06-16 16:25 ` Jason Gunthorpe
2025-06-17 2:02 ` Nicolin Chen
2025-06-17 11:59 ` Jason Gunthorpe
2025-06-17 21:23 ` Nicolin Chen
2025-06-17 23:01 ` Jason Gunthorpe
2025-06-17 23:46 ` Nicolin Chen
2025-06-18 11:38 ` Jason Gunthorpe [this message]
2025-06-16 5:02 ` [PATCH rc 2/4] iommufd/selftest: Add missing close(mfd) in memfd_mmap() Nicolin Chen
2025-06-16 16:25 ` Jason Gunthorpe
2025-06-16 5:02 ` [PATCH rc 3/4] iommufd/selftest: Add asserts testing global mfd Nicolin Chen
2025-06-16 16:26 ` Jason Gunthorpe
2025-06-16 5:02 ` [PATCH rc 4/4] iommufd/selftest: Fix build warnings due to uninitialized mfd Nicolin Chen
2025-06-16 16:27 ` Jason Gunthorpe
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=20250618113850.GE1575786@nvidia.com \
--to=jgg@nvidia.com \
--cc=iommu@lists.linux.dev \
--cc=joao.m.martins@oracle.com \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=nicolinc@nvidia.com \
--cc=shuah@kernel.org \
--cc=steven.sistare@oracle.com \
--cc=thomas.weissschuh@linutronix.de \
/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