lkml.org 
[lkml]   [2023]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [v3] fs/proc/task_mmu: Implement IOCTL for efficient page table scanning
On Thu, 27 Jul 2023 at 13:18, Michał Mirosław <emmir@google.com> wrote:
> On Thu, 27 Jul 2023 at 01:06, Paul Gofman <pgofman@codeweavers.com> wrote:
> > Hello Michał,
> >
> > I was looking into that from the Wine point of view and did a bit
> > of testing, so will try to answer the question cited below.
>
> Thanks for the extensive explanation!
>
> > Without Windows large pages I guess the only way to make this work
> > correctly is to disable THP with madvise(MADV_NOHUGEPAGE) on the memory
> > ranges allocated with MEM_WRITE_WATCH, as the memory changes should not
> > only be reported but also tracked with 4k page granularity as Windows
> > applications expect.
> >
> > Currently we don't implement MEM_LARGE_PAGES flag support in Wine
> > (while of course might want to do that in the future). On Windows using
> > this flag requires special permissions and implies more than just using
> > huge pages under the hood but also, in particular, locking pages in
> > memory. I'd expect that support to be extended in Windows though in the
> > future in some way. WRT write watches, the range is watched with large
> > page granularity. GetWriteWatch lpdwGranularity output parameter returns
> > the value of "large page minimum" (returned by GetLargePageMinimum) and
> > the returned addresses correspond to those large pages. I suppose to
> > implement that on top of Linux huge pages we'd need a way to control
> > huge pages allocation at the first place, i. e., a way to enforce the
> > specified size for the huge pages for the memory ranged being mapped.
> > Without that I am afraid the only way to correctly implement that is to
> > still disable THP on the range and only adjust our API output so that
> > matches expected.
[...]

The THP case we can leave it to userspace, as it can madvise() if the
optimization lost due to dirty tracking of THP is more than THP adds.
(BTW, the WP-watch is done via uffd - the default change would need to
happen there).

Best Regards
> Michał Mirosław

\
 
 \ /
  Last update: 2023-07-27 13:23    [W:0.127 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site