Re: [PATCH] mm, thp: Relax the VM_DENYWRITE constraint on file-backed THPs

2021-04-06 Thread William Kucharski
Sounds good. Reviewed-by: William Kucharski > On Apr 6, 2021, at 11:48 AM, Collin Fijalkovich > wrote: > > Instrumenting filemap_nr_thps_inc() should be sufficient for ensuring > writable file mappings will not be THP-backed. > > If filemap_nr_thps_dec() in unaccount_page_cache_page() and >

Re: [PATCH] mm, thp: Relax the VM_DENYWRITE constraint on file-backed THPs

2021-04-06 Thread Collin Fijalkovich
Instrumenting filemap_nr_thps_inc() should be sufficient for ensuring writable file mappings will not be THP-backed. If filemap_nr_thps_dec() in unaccount_page_cache_page() and filemap_nr_thps() in do_dentry_open() race, the worst case is an unnecessary truncation. We could introduce a memory barr

Re: [PATCH] mm, thp: Relax the VM_DENYWRITE constraint on file-backed THPs

2021-04-05 Thread William Kucharski
I saw a similar change a few years ago with my prototype: https://lore.kernel.org/linux-mm/5bb682e1-dd52-4aa9-83e9-def091e0c...@oracle.com/ the key being a very nice drop in iTLB-load-misses, so it looks like your code is having the right effect. What about the call to filemap_nr_thps_dec() i

Re: [PATCH] mm, thp: Relax the VM_DENYWRITE constraint on file-backed THPs

2021-04-05 Thread Collin Fijalkovich
v2 has been uploaded with performance testing results: https://lore.kernel.org/patchwork/patch/1408266/ On Mon, Mar 22, 2021 at 2:59 PM Collin Fijalkovich wrote: > > Transparent huge pages are supported for read-only non-shmem filesystems, > but are only used for vmas with VM_DENYWRITE. This co

Re: [PATCH] mm, thp: Relax the VM_DENYWRITE constraint on file-backed THPs

2021-03-30 Thread Collin Fijalkovich
There will be an immediate performance hit when the file is opened for write, as its associated pages are removed from the page cache. While the writer is present there will be the usual overhead of using 4kB pages instead of THPs, but there should not be an additional penalty. It is problematic if

Re: [PATCH] mm, thp: Relax the VM_DENYWRITE constraint on file-backed THPs

2021-03-28 Thread Song Liu
> On Mar 23, 2021, at 10:13 AM, Collin Fijalkovich > wrote: > > Question: when we use this on shared library, the library is still > writable. When the > shared library is opened for write, these pages will refault in as 4kB > pages, right? > > That's correct, while a file is opened for wri

Re: [PATCH] mm, thp: Relax the VM_DENYWRITE constraint on file-backed THPs

2021-03-23 Thread William Kucharski
I like this, it reminds me of the changes I proposed a few years ago to try to automatically map read-only text regions of appropriate sizes and alignment with THPs. My concern had always been whether commercial software and distro vendors would buy into supplying the appropriate linker flags when

Re: [PATCH] mm, thp: Relax the VM_DENYWRITE constraint on file-backed THPs

2021-03-22 Thread Song Liu
On Mon, Mar 22, 2021 at 3:00 PM Collin Fijalkovich wrote: > > Transparent huge pages are supported for read-only non-shmem filesystems, > but are only used for vmas with VM_DENYWRITE. This condition ensures that > file THPs are protected from writes while an application is running > (ETXTBSY). An

[PATCH] mm, thp: Relax the VM_DENYWRITE constraint on file-backed THPs

2021-03-22 Thread Collin Fijalkovich
Transparent huge pages are supported for read-only non-shmem filesystems, but are only used for vmas with VM_DENYWRITE. This condition ensures that file THPs are protected from writes while an application is running (ETXTBSY). Any existing file THPs are then dropped from the page cache when a file