[PATCH] btrfs: Use readahead_batch_length

2021-03-21 Thread Matthew Wilcox (Oracle)
Implement readahead_batch_length() to determine the number of bytes in the current batch of readahead pages and use it in btrfs. Signed-off-by: Matthew Wilcox (Oracle) --- fs/btrfs/extent_io.c| 6 ++ include/linux/pagemap.h | 9 + 2 files changed, 11 insertions(+), 4 deletions

Re: [PATCH v4 02/28] mm: Add an unlock function for PG_private_2/PG_fscache

2021-03-21 Thread Matthew Wilcox
On Wed, Mar 10, 2021 at 04:54:49PM +, David Howells wrote: > Add a function, unlock_page_private_2(), to unlock PG_private_2 analogous > to that of PG_lock. Add a kerneldoc banner to that indicating the example > usage case. One of the things which confused me about this was ... where's the

Re: [PATCH v4 08/28] netfs: Provide readahead and readpage netfs helpers

2021-03-20 Thread Matthew Wilcox
On Wed, Mar 10, 2021 at 04:56:13PM +, David Howells wrote: > +void netfs_readahead(struct readahead_control *ractl, > + const struct netfs_read_request_ops *ops, > + void *netfs_priv) > +{ > + struct netfs_read_request *rreq; > + struct page *page; > +

Re: [PATCH v4 3/3] mm: fs: Invalidate BH LRU during page migration

2021-03-20 Thread Matthew Wilcox
On Sat, Mar 20, 2021 at 10:20:09AM -0700, Minchan Kim wrote: > > > Tested-by: Oliver Sang > > > Reported-by: kernel test robot > > > Signed-off-by: Chris Goldsworthy > > > Signed-off-by: Minchan Kim > > > > The signoff chain ordering might mean that Chris was the primary author, but > > there

[PATCH v5 27/27] mm/doc: Build kerneldoc for various mm files

2021-03-19 Thread Matthew Wilcox (Oracle)
These files weren't included in the html docs. Signed-off-by: Matthew Wilcox (Oracle) --- Documentation/core-api/mm-api.rst | 7 +++ 1 file changed, 7 insertions(+) diff --git a/Documentation/core-api/mm-api.rst b/Documentation/core-api/mm-api.rst index 874ae1250258..3af5875a1d9e 100644

[PATCH v5 23/27] mm/writeback: Add wait_for_stable_folio

2021-03-19 Thread Matthew Wilcox (Oracle)
Move wait_for_stable_page() into the folio compatibility file. wait_for_stable_folio() avoids a call to compound_head() and is 14 bytes smaller than wait_for_stable_page() was. The net text size grows by 24 bytes as a result of this patch. Signed-off-by: Matthew Wilcox (Oracle) --- include

[PATCH v5 25/27] mm/filemap: Convert wake_up_page_bit to wake_up_folio_bit

2021-03-19 Thread Matthew Wilcox (Oracle)
All callers have a folio, so use it directly. Signed-off-by: Matthew Wilcox (Oracle) --- mm/filemap.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index f8746c149562..f5bacbe702ff 100644 --- a/mm/filemap.c +++ b/mm

[PATCH v5 26/27] mm/filemap: Convert page wait queues to be folios

2021-03-19 Thread Matthew Wilcox (Oracle)
Reinforce that if we're waiting for a bit in a struct page, that's actually in the head page by changing the type from page to folio. Increases the size of cachefiles by two bytes, but the kernel core is unchanged in size. Signed-off-by: Matthew Wilcox (Oracle) --- fs/cachefiles/rdwr.c| 16

[PATCH v5 24/27] mm/filemap: Convert wait_on_page_bit to wait_on_folio_bit

2021-03-19 Thread Matthew Wilcox (Oracle)
We must always wait on the folio, otherwise we won't be woken up. This commit shrinks the kernel by 691 bytes, mostly due to moving the page waitqueue lookup into wait_on_folio_bit_common(). Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/netfs.h | 2 +- include/linux/pagemap.h

[PATCH v5 22/27] mm/writeback: Add wait_on_folio_writeback

2021-03-19 Thread Matthew Wilcox (Oracle)
to compound_head() which saves 8 bytes and 15 bytes in the two functions. That is more than offset by adding the wait_on_page_writeback compatibility wrapper for a net increase in text of 15 bytes. Signed-off-by: Matthew Wilcox (Oracle) --- fs/afs/write.c | 2 +- include/linux/pagemap.h | 3 ++- mm

[PATCH v5 20/27] mm/filemap: Add wait_on_folio_locked

2021-03-19 Thread Matthew Wilcox (Oracle)
Also add wait_on_folio_locked_killable(). Turn wait_on_page_locked() and wait_on_page_locked_killable() into wrappers. This eliminates a call to compound_head() from each call-site, reducing text size by 200 bytes for me. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 26

[PATCH v5 21/27] mm/filemap: Add end_folio_writeback

2021-03-19 Thread Matthew Wilcox (Oracle)
this a net saving of 70 bytes. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 3 ++- mm/filemap.c| 38 +++--- mm/folio-compat.c | 6 ++ 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/include/linux/pagemap.h b

[PATCH v5 18/27] mm/filemap: Add __lock_folio_async

2021-03-19 Thread Matthew Wilcox (Oracle)
to 403 bytes, saving 111 bytes. The text shrinks by 132 bytes in total. Signed-off-by: Matthew Wilcox (Oracle) --- fs/io_uring.c | 2 +- include/linux/pagemap.h | 17 - mm/filemap.c| 31 --- 3 files changed, 17 insertions(+), 33

[PATCH v5 19/27] mm/filemap: Add __lock_folio_or_retry

2021-03-19 Thread Matthew Wilcox (Oracle)
-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 9 ++--- mm/filemap.c| 10 -- mm/memory.c | 8 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 3cd1b5e28593..38f4ee28a3a5 100644

[PATCH v5 17/27] mm/filemap: Add lock_folio_killable

2021-03-19 Thread Matthew Wilcox (Oracle)
__lock_page_killable() was. lock_page_maybe_drop_mmap() shrinks by 68 bytes and __lock_page_or_retry() shrinks by 66 bytes. That's a total of 154 bytes of text saved. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 15 ++- mm/filemap.c| 17 + 2 files

[PATCH v5 15/27] mm/filemap: Add unlock_folio

2021-03-19 Thread Matthew Wilcox (Oracle)
path that uses unlock_folio() will execute 4 fewer instructions. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 3 ++- mm/filemap.c| 27 ++- mm/folio-compat.c | 6 ++ 3 files changed, 18 insertions(+), 18 deletions(-) diff

[PATCH v5 13/27] mm/util: Add folio_mapping and folio_file_mapping

2021-03-19 Thread Matthew Wilcox (Oracle)
sequence will disappear. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 14 -- include/linux/pagemap.h | 35 +-- include/linux/swap.h| 6 ++ mm/Makefile | 2 +- mm/folio-compat.c | 13 + mm

[PATCH v5 14/27] mm/memcg: Add folio wrappers for various functions

2021-03-19 Thread Matthew Wilcox (Oracle)
Add new wrapper functions folio_memcg(), lock_folio_memcg(), unlock_folio_memcg() and mem_cgroup_folio_lruvec(). Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/memcontrol.h | 21 + 1 file changed, 21 insertions(+) diff --git a/include/linux/memcontrol.h b/include

[PATCH v5 12/27] mm: Add folio_index, folio_file_page and folio_contains

2021-03-19 Thread Matthew Wilcox (Oracle)
folio_index() is the equivalent of page_index() for folios. folio_file_page() is the equivalent of find_subpage(). folio_contains() is the equivalent of thp_contains(). Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 53 + 1 file

[PATCH v5 16/27] mm/filemap: Add lock_folio

2021-03-19 Thread Matthew Wilcox (Oracle)
. __lock_folio is 59 bytes while __lock_page was 79. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 24 +++- mm/filemap.c| 29 +++-- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/include/linux/pagemap.h b/include

[PATCH v5 11/27] mm: Handle per-folio private data

2021-03-19 Thread Matthew Wilcox (Oracle)
() & put_page(). Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm_types.h | 16 ++ include/linux/pagemap.h | 48 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h i

[PATCH v5 10/27] mm: Create FolioFlags

2021-03-19 Thread Matthew Wilcox (Oracle)
. This saves 1727 bytes of text with the distro-derived config that I'm testing due to removing a double call to compound_head() in PageSwapCache(). Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/page-flags.h | 120 ++--- 1 file changed, 100 insertions(+), 20

[PATCH v5 08/27] mm: Add put_folio

2021-03-19 Thread Matthew Wilcox (Oracle)
functions grow a little while others shrink. I presume the compiler is making different inlining decisions. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Zi Yan --- include/linux/mm.h | 28 +++- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/include

[PATCH v5 09/27] mm: Add get_folio

2021-03-19 Thread Matthew Wilcox (Oracle)
If we know we have a folio, we can call get_folio() instead of get_page() and save the overhead of calling compound_head(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Zi Yan --- include/linux/mm.h | 26 +- 1 file changed, 17 insertions(+), 9 deletions(-) diff

[PATCH v5 07/27] mm/debug: Add VM_BUG_ON_FOLIO and VM_WARN_ON_ONCE_FOLIO

2021-03-19 Thread Matthew Wilcox (Oracle)
These are the folio equivalents of VM_BUG_ON_PAGE and VM_WARN_ON_ONCE_PAGE. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Zi Yan --- include/linux/mmdebug.h | 20 1 file changed, 20 insertions(+) diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h index

[PATCH v5 04/27] mm: Introduce struct folio

2021-03-19 Thread Matthew Wilcox (Oracle)
page. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 78 include/linux/mm_types.h | 36 +++ 2 files changed, 114 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index cb1e191da319..9b7e3fa12fd3

[PATCH v5 05/27] mm: Add folio_pgdat and folio_zone

2021-03-19 Thread Matthew Wilcox (Oracle)
These are just convenience wrappers for callers with folios; pgdat and zone can be reached from tail pages as well as head pages. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Zi Yan --- include/linux/mm.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/include/linux/mm.h

[PATCH v5 02/27] mm/writeback: Add wait_on_page_writeback_killable

2021-03-19 Thread Matthew Wilcox (Oracle)
This is the killable version of wait_on_page_writeback. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 1 + mm/page-writeback.c | 16 2 files changed, 17 insertions(+) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 139678f382ff

[PATCH v5 00/27] Memory Folios

2021-03-19 Thread Matthew Wilcox (Oracle)
ources of conflict, the generic_file_buffered_read refactoring (in akpm tree) and the fscache work (in dhowells tree). v2: - Pare patch series back to just infrastructure and the page waiting parts. Matthew Wilcox (Oracle) (27): fs/cachefiles: Remove wait_bit_key layout dependency

[PATCH v5 06/27] mm/vmstat: Add functions to account folio statistics

2021-03-19 Thread Matthew Wilcox (Oracle)
Allow page counters to be more readily modified by callers which have a folio. Name these wrappers with 'stat' instead of 'state' as requested by Linus here: https://lore.kernel.org/linux-mm/CAHk-=wj847sudr-kt+46ft3+xffgiwpgthvm7djwgdi4cvr...@mail.gmail.com/ Signed-off-by: Matthew Wilcox (Oracle

[PATCH v5 01/27] fs/cachefiles: Remove wait_bit_key layout dependency

2021-03-19 Thread Matthew Wilcox (Oracle)
Cachefiles was relying on wait_page_key and wait_bit_key being the same layout, which is fragile. Now that wait_page_key is exposed in the pagemap.h header, we can remove that fragility Signed-off-by: Matthew Wilcox (Oracle) --- fs/cachefiles/rdwr.c| 7 +++ include/linux/pagemap.h | 1

[PATCH v5 03/27] afs: Use wait_on_page_writeback_killable

2021-03-19 Thread Matthew Wilcox (Oracle)
Open-coding this function meant it missed out on the recent bugfix for waiters being woken by a delayed wake event from a previous instantiation of the page. Signed-off-by: Matthew Wilcox (Oracle) --- fs/afs/write.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/afs

Re: [PATCH] mm: page_alloc: fix memcg accounting leak in speculative cache lookup

2021-03-19 Thread Matthew Wilcox
On Fri, Mar 19, 2021 at 06:52:58PM -0700, Hugh Dickins wrote: > > + /* > > +* Drop the base reference from __alloc_pages and free. In > > +* case there is an outstanding speculative reference, from > > +* e.g. the page cache, it will put and free the page later. > > +*/ > > +

Re: [PATCH v3] mm/gup: check page posion status for coredump.

2021-03-19 Thread Matthew Wilcox
On Fri, Mar 19, 2021 at 10:44:37AM +0800, Aili Yao wrote: > +++ b/mm/gup.c > @@ -1536,6 +1536,10 @@ struct page *get_dump_page(unsigned long addr) > FOLL_FORCE | FOLL_DUMP | FOLL_GET); > if (locked) > mmap_read_unlock(mm); > + > + if (ret

Re: [PATCH v4] mm: cma: support sysfs

2021-03-19 Thread Matthew Wilcox
On Fri, Mar 19, 2021 at 08:29:29PM +0300, Dmitry Osipenko wrote: > > +static ssize_t alloc_pages_success_show(struct kobject *kobj, > > + struct kobj_attribute *attr, char *buf) > > The indentations are still wrong. > > CHECK: Alignment should match open parenthesis > #321:

Re: [PATCH] net/rds: correct socket tunable error in rds_tcp_tune()

2021-03-19 Thread Matthew Wilcox
copy-n-paste error. I think Coverity have started looking for issues like this? Reviewed-by: Matthew Wilcox (Oracle) Also, maybe, Fixes: c6a58ffed536 ("RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket")

Re: [PATCH] io_uring: Try to merge io requests only for regular files

2021-03-19 Thread Matthew Wilcox
On Fri, Mar 19, 2021 at 05:28:59AM +, Dmitry Monakhov wrote: > Otherwise we may endup blocking on pipe or socket. > > Fixes: 6d5d5ac ("io_uring: extend async work merge") 7 bytes of sha1 isn't enough. You can set core.abbrev to 12 or upgrade to a version of git from this decade to get that

Re: [PATCH] mm: page_alloc: fix memcg accounting leak in speculative cache lookup

2021-03-19 Thread Matthew Wilcox
On Fri, Mar 19, 2021 at 03:15:47AM -0400, Johannes Weiner wrote: > When the freeing of a higher-order page block (non-compound) races > with a speculative page cache lookup, __free_pages() needs to leave > the first order-0 page in the chunk to the lookup but free the buddy > pages that the lookup

Re: [PATCH v4 00/25] Page folios

2021-03-18 Thread Matthew Wilcox
On Fri, Mar 05, 2021 at 04:18:36AM +, Matthew Wilcox (Oracle) wrote: > Our type system does not currently distinguish between tail pages and > head or single pages. This is a problem because we call compound_head() > multiple times (and the compiler cannot optimise it out),

Re: [PATCH v4 01/25] mm: Introduce struct folio

2021-03-18 Thread Matthew Wilcox
On Fri, Mar 19, 2021 at 10:56:45AM +1100, Balbir Singh wrote: > On Fri, Mar 05, 2021 at 04:18:37AM +0000, Matthew Wilcox (Oracle) wrote: > > A struct folio refers to an entire (possibly compound) page. A function > > which takes a struct folio argument declares that

Re: [PATCH v1] mm, hwpoison: enable error handling on shmem thp

2021-03-18 Thread Matthew Wilcox
On Thu, Mar 11, 2021 at 02:00:40PM -0800, Hugh Dickins wrote: > On Thu, 11 Mar 2021, Jue Wang wrote: > > In our experiment with SHMEM THPs, later accesses resulted in a zero > > page allocated instead of a SIGBUS with BUS_MCEERR_AR reported by the > > page fault handler. That part might be an

Re: [PATCH v4 08/25] mm: Handle per-folio private data

2021-03-18 Thread Matthew Wilcox
On Wed, Mar 17, 2021 at 06:20:32PM +0100, Christoph Hellwig wrote: > > +static inline void attach_page_private(struct page *page, void *data) > > +{ > > + attach_folio_private((struct folio *)page, data); > > +} > > + > > +static inline void *detach_page_private(struct page *page) > > +{ > > +

Re: [PATCH v2 2/2] mm/memcg: set memcg when split page

2021-03-18 Thread Matthew Wilcox
On Thu, Mar 18, 2021 at 03:05:00PM +0100, Michal Hocko wrote: > On Thu 11-03-21 12:37:20, Hugh Dickins wrote: > > On Thu, 11 Mar 2021, Michal Hocko wrote: > > > On Thu 11-03-21 10:21:39, Johannes Weiner wrote: > > > > On Thu, Mar 11, 2021 at 09:37:02AM +0100, Michal Hocko wrote: > > > > >

Re: [PATCH] fs/dcache: fix typos and sentence disorder

2021-03-18 Thread Matthew Wilcox
On Thu, Mar 18, 2021 at 10:31:53PM +0800, Xiaofeng Cao wrote: > change 'sould' to 'should' > change 'colocated' to 'collocated' uh. collocated is incorrect. colocated is correct. https://www.merriam-webster.com/dictionary/colocate https://www.merriam-webster.com/dictionary/collocate The other

Re: fuse: kernel BUG at mm/truncate.c:763!

2021-03-18 Thread Matthew Wilcox
On Thu, Mar 18, 2021 at 11:29:28AM +, Luis Henriques wrote: > On Thu, Mar 18, 2021 at 02:03:02PM +0300, Kirill A. Shutemov wrote: > > On Thu, Mar 18, 2021 at 11:59:59AM +0100, Miklos Szeredi wrote: > > > > [16247.536348] page:dfe36ab1 refcount:673 mapcount:0 > > > >

Re: [PATCH] mm/gup: check page posion status for coredump.

2021-03-17 Thread Matthew Wilcox
On Wed, Mar 17, 2021 at 10:12:02AM +0100, David Hildenbrand wrote: > > + if (IS_ENABLED(CONFIG_MEMORY_FAILURE) && ret == 1) { > > + if (unlikely(PageHuge(page) && > > PageHWPoison(compound_head(page > > + ret = 0; > > + else if

[PATCH v2] mm: Move page_mapping_file to pagemap.h

2021-03-17 Thread Matthew Wilcox (Oracle)
page_mapping_file() is only used by some architectures, and then it is usually only used in one place. Make it a static inline function so other architectures don't have to carry this dead code. Signed-off-by: Matthew Wilcox (Oracle) --- v2: Ensure pagemap.h is included in all the files which

Re: [PATCH] mm: Typo fix in the file util.c

2021-03-17 Thread Matthew Wilcox
On Wed, Mar 17, 2021 at 09:04:39AM +0530, Bhaskar Chowdhury wrote: > > > s/condtion/condition/ The usual subject line for this would be: mm/util: Fix typo > Signed-off-by: Bhaskar Chowdhury > --- > mm/util.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/util.c

Re: [PATCH v4 02/28] mm: Add an unlock function for PG_private_2/PG_fscache

2021-03-16 Thread Matthew Wilcox
On Tue, Mar 16, 2021 at 08:38:00PM +, David Howells wrote: > Matthew Wilcox wrote: > > > So ... a page with both flags cleared should have a refcount of N. > > A page with one or both flags set should have a refcount of N+1. > > ... > > How is a poor filesys

Re: [PATCH v4 02/28] mm: Add an unlock function for PG_private_2/PG_fscache

2021-03-16 Thread Matthew Wilcox
On Wed, Mar 10, 2021 at 04:54:49PM +, David Howells wrote: > Add a function, unlock_page_private_2(), to unlock PG_private_2 analogous > to that of PG_lock. Add a kerneldoc banner to that indicating the example > usage case. This isn't a problem with this patch per se, but I'm concerned

Re: [PATCH v1 11/14] mm: multigenerational lru: page activation

2021-03-16 Thread Matthew Wilcox
On Sat, Mar 13, 2021 at 12:57:44AM -0700, Yu Zhao wrote: > In the page fault path, we want to add pages to the per-zone lists > index by max_seq as they cannot be evicted without going through > the aging first. For anon pages, we rename > lru_cache_add_inactive_or_unevictable() to

[PATCH] mm: Move page_mapping_file to pagemap.h

2021-03-16 Thread Matthew Wilcox (Oracle)
page_mapping_file() is only used by some architectures, and then it is usually only used in one place. Make it a static inline function so other architectures don't have to carry this dead code. Signed-off-by: Matthew Wilcox (Oracle) --- I'm not entirely sure all the affected architectures

Re: [PATCH v3] fs/buffer.c: Revoke LRU when trying to drop buffers

2021-03-15 Thread Matthew Wilcox
On Mon, Mar 15, 2021 at 04:41:38PM -0700, Andrew Morton wrote: > > When a buffer is added to the LRU list, a reference is taken which is > > not dropped until the buffer is evicted from the LRU list. This is the > > correct behavior, however this LRU reference will prevent the buffer > > from

Re: [PATCH -next 1/5] block: add disk sequence number

2021-03-15 Thread Matthew Wilcox
On Mon, Mar 15, 2021 at 08:18:24PM +, Matthew Wilcox wrote: > On Mon, Mar 15, 2021 at 09:02:38PM +0100, Matteo Croce wrote: > > From: Matteo Croce > > > > Add a sequence number to the disk devices. This number is put in the > > uevent so userspace can correlate

Re: [PATCH -next 1/5] block: add disk sequence number

2021-03-15 Thread Matthew Wilcox
On Mon, Mar 15, 2021 at 09:02:38PM +0100, Matteo Croce wrote: > From: Matteo Croce > > Add a sequence number to the disk devices. This number is put in the > uevent so userspace can correlate events when a driver reuses a device, > like the loop one. Should this be documented as monotonically

Re: [PATCH -next 2/5] block: add ioctl to read the disk sequence number

2021-03-15 Thread Matthew Wilcox
On Mon, Mar 15, 2021 at 09:02:39PM +0100, Matteo Croce wrote: > +++ b/include/uapi/linux/fs.h > @@ -184,6 +184,7 @@ struct fsxattr { > #define BLKSECDISCARD _IO(0x12,125) > #define BLKROTATIONAL _IO(0x12,126) > #define BLKZEROOUT _IO(0x12,127) > +#define BLKGETDISKSEQ _IOR(0x12,128,__u64) > /*

Re: [PATCH v4 00/25] Page folios

2021-03-15 Thread Matthew Wilcox
On Mon, Mar 15, 2021 at 07:09:04PM +, Christoph Hellwig wrote: > On Mon, Mar 15, 2021 at 01:38:04PM +0100, Michal Hocko wrote: > > I tend to agree here as well. The level compoud_head has spread out > > silently is just too large. There are people coming up with all sorts of > > optimizations

Re: [PATCH v4 00/25] Page folios

2021-03-15 Thread Matthew Wilcox
On Mon, Mar 15, 2021 at 02:55:01PM +0300, Kirill A. Shutemov wrote: > I'm with Matthew on this. I would really want to drop the number of places > where we call compoud_head(). I hope we can get rid of the page flag > policy hack I made. I can't see that far ahead too clearly, but I do think that

Re: [RFC][PATCH 0/3] vfs: Use an xarray instead of inserted bookmarks to scan mount list

2021-03-15 Thread Matthew Wilcox
On Mon, Mar 15, 2021 at 02:14:35PM +0100, Miklos Szeredi wrote: > On Mon, Mar 15, 2021 at 1:07 PM David Howells wrote: > > > > > > Hi Al, Miklós, > > > > Can we consider replacing the "insert cursor" approach we're currently > > using for proc files to scan the current namespace's mount list[1]

Re: [PATCH 2/3] vfs: Use the mounts_to_id array to do /proc/mounts and co.

2021-03-15 Thread Matthew Wilcox
On Mon, Mar 15, 2021 at 12:07:56PM +, David Howells wrote: > Use the mounts_to_id xarray added to the mount namespace to perform You called it mounts_by_id in the last patch ... > Since it doesn't trawl a standard list_head, but rather uses xarray, this > could be done under the RCU read

Re: [RFC][PATCH 0/3] vfs: Use an xarray instead of inserted bookmarks to scan mount list

2021-03-15 Thread Matthew Wilcox
On Mon, Mar 15, 2021 at 12:07:39PM +, David Howells wrote: > > Hi Al, Miklós, > > Can we consider replacing the "insert cursor" approach we're currently > using for proc files to scan the current namespace's mount list[1] with > something that uses an xarray of mounts indexed by mnt_id? > >

Re: fuse: kernel BUG at mm/truncate.c:763!

2021-03-15 Thread Matthew Wilcox
On Mon, Mar 15, 2021 at 09:47:45AM +, Luis Henriques wrote: > On Fri, Mar 12, 2021 at 01:11:23PM +0000, Matthew Wilcox wrote: > > On Fri, Mar 12, 2021 at 12:21:59PM +, Luis Henriques wrote: > > > > > I've seen a bug report (5.10.16 kernel

Re: [PATCH v4 07/25] mm: Create FolioFlags

2021-03-14 Thread Matthew Wilcox
On Fri, Mar 05, 2021 at 04:18:43AM +, Matthew Wilcox (Oracle) wrote: > These new functions are the folio analogues of the PageFlags functions. > If CONFIG_DEBUG_VM_PGFLAGS is enabled, we check the folio is not a tail > page at every invocation. Note that this will also catch the Pag

Re: [PATCH v1 06/14] mm, x86: support the access bit on non-leaf PMD entries

2021-03-14 Thread Matthew Wilcox
On Sun, Mar 14, 2021 at 06:12:42PM -0400, Zi Yan wrote: > On 13 Mar 2021, at 2:57, Yu Zhao wrote: > > > Some architectures support the accessed bit on non-leaf PMD entries > > (parents) in addition to leaf PTE entries (children) where pages are > > mapped, e.g., x86_64 sets the accessed bit on a

Re: [PATCH v4 03/25] mm/vmstat: Add functions to account folio statistics

2021-03-13 Thread Matthew Wilcox
On Sat, Mar 13, 2021 at 12:37:07PM -0800, Andrew Morton wrote: > On Fri, 5 Mar 2021 04:18:39 +0000 "Matthew Wilcox (Oracle)" > wrote: > > > Allow page counters to be more readily modified by callers which have > > a folio. Name these wrappers with 'stat'

Re: [PATCH v4 01/25] mm: Introduce struct folio

2021-03-13 Thread Matthew Wilcox
On Sat, Mar 13, 2021 at 12:37:02PM -0800, Andrew Morton wrote: > On Fri, 5 Mar 2021 04:18:37 +0000 "Matthew Wilcox (Oracle)" > wrote: > > > A struct folio refers to an entire (possibly compound) page. A function > > which takes a struct folio argumen

Re: [PATCH v4 09/25] mm: Add folio_index, folio_page and folio_contains

2021-03-13 Thread Matthew Wilcox
On Sat, Mar 13, 2021 at 12:37:16PM -0800, Andrew Morton wrote: > On Fri, 5 Mar 2021 04:18:45 +0000 "Matthew Wilcox (Oracle)" > wrote: > > folio_index() is the equivalent of page_index() for folios. folio_page() > > finds the page in a folio for a page cache index.

Re: [PATCH v4 00/25] Page folios

2021-03-13 Thread Matthew Wilcox
On Sat, Mar 13, 2021 at 12:36:58PM -0800, Andrew Morton wrote: > On Fri, 5 Mar 2021 04:18:36 +0000 "Matthew Wilcox (Oracle)" > wrote: > > > Our type system does not currently distinguish between tail pages and > > head or single pages. This is a proble

Re: [PATCH 1/6] mm/huge_memory.c: rework the function vma_adjust_trans_huge()

2021-03-13 Thread Matthew Wilcox
On Sat, Mar 13, 2021 at 05:32:19AM -0500, Miaohe Lin wrote: > +static inline void try_to_split_huge_pmd_address(struct vm_area_struct *vma, > unsigned long address) > +{ > + if (address & ~HPAGE_PMD_MASK && > + range_in_vma(vma, address & HPAGE_PMD_MASK, > +

Re: [PATCH 2/5] mm/page_alloc: Add a bulk page allocator

2021-03-13 Thread Matthew Wilcox
On Sat, Mar 13, 2021 at 04:56:31PM +, Chuck Lever III wrote: > IME lists are indeed less CPU-efficient, but I wonder if that > expense is insignificant compared to serialization primitives like > disabling and re-enabling IRQs, which we are avoiding by using > bulk page allocation. Cache

Re: [PATCH 2/5] mm/page_alloc: Add a bulk page allocator

2021-03-13 Thread Matthew Wilcox
On Sat, Mar 13, 2021 at 01:16:48PM +, Mel Gorman wrote: > > I'm not claiming the pagevec is definitely a win, but it's very > > unclear which tradeoff is actually going to lead to better performance. > > Hopefully Jesper or Chuck can do some tests and figure out what actually > > works better

Re: [PATCH v1 01/14] include/linux/memcontrol.h: do not warn in page_memcg_rcu() if !CONFIG_MEMCG

2021-03-13 Thread Matthew Wilcox
On Sat, Mar 13, 2021 at 12:57:34AM -0700, Yu Zhao wrote: > We want to make sure the rcu lock is held while using > page_memcg_rcu(). But having a WARN_ON_ONCE() in page_memcg_rcu() when > !CONFIG_MEMCG is superfluous because of the following legit use case: > > memcg = lock_page_memcg(page1) >

Re: [PATCH 2/5] mm/page_alloc: Add a bulk page allocator

2021-03-12 Thread Matthew Wilcox
On Fri, Mar 12, 2021 at 04:03:50PM +, Mel Gorman wrote: > On Fri, Mar 12, 2021 at 02:58:14PM +0000, Matthew Wilcox wrote: > > On Fri, Mar 12, 2021 at 12:46:09PM +0100, Jesper Dangaard Brouer wrote: > > > In my page_pool patch I'm bulk allocating 64 pages. I wanted to ask if

Re: [PATCH 0/5] Introduce a bulk order-0 page allocator with two in-tree users

2021-03-12 Thread Matthew Wilcox
On Thu, Mar 11, 2021 at 08:48:27AM +, Mel Gorman wrote: > I don't have that information unfortunately. It's a chicken and egg > problem because without the API, there is no point creating new users. > For example, fault around or readahead could potentially batch pages > but whether it is

Re: [PATCH 2/5] mm/page_alloc: Add a bulk page allocator

2021-03-12 Thread Matthew Wilcox
On Fri, Mar 12, 2021 at 12:46:09PM +0100, Jesper Dangaard Brouer wrote: > In my page_pool patch I'm bulk allocating 64 pages. I wanted to ask if > this is too much? (PP_ALLOC_CACHE_REFILL=64). > > The mlx5 driver have a while loop for allocation 64 pages, which it > used in this case, that is why

Re: fuse: kernel BUG at mm/truncate.c:763!

2021-03-12 Thread Matthew Wilcox
On Fri, Mar 12, 2021 at 12:21:59PM +, Luis Henriques wrote: > > > I've seen a bug report (5.10.16 kernel splat below) that seems to be > > > reproducible in kernels as early as 5.4. If this is reproducible, can you turn this BUG_ON into a VM_BUG_ON_PAGE() so we know what kind of problem we're

Re: [PATCH 2/5] mm/page_alloc: Add a bulk page allocator

2021-03-12 Thread Matthew Wilcox
On Wed, Mar 10, 2021 at 10:46:15AM +, Mel Gorman wrote: > +int __alloc_pages_bulk_nodemask(gfp_t gfp_mask, int preferred_nid, > + nodemask_t *nodemask, int nr_pages, > + struct list_head *list); For the next revision, can you ditch the

Re: [PATCH v2 2/2] mm/memcg: set memcg when split page

2021-03-11 Thread Matthew Wilcox
On Thu, Mar 11, 2021 at 10:21:39AM -0500, Johannes Weiner wrote: > On Thu, Mar 11, 2021 at 09:37:02AM +0100, Michal Hocko wrote: > > Johannes, Hugh, > > > > what do you think about this approach? If we want to stick with > > split_page approach then we need to update the missing place Matthew has

Re: [PATCH v1] mm, hwpoison: enable error handling on shmem thp

2021-03-11 Thread Matthew Wilcox
On Wed, Mar 10, 2021 at 11:22:18PM -0800, Hugh Dickins wrote: > But something we found on the way, > we do have a patch for: add_to_kill() uses page_address_in_vma(), but > that has not been used on file THP tails before - fix appended at the > end below, so as not to waste your time on that bit.

Re: [question] Panic in dax_writeback_one

2021-03-11 Thread Matthew Wilcox
On Thu, Mar 11, 2021 at 07:48:25AM +, chenjun (AM) wrote: > static int dax_writeback_one(struct xa_state *xas, struct dax_device > *dax_dev, struct address_space *mapping, void *entry) > dax_flush(dax_dev, page_address(pfn_to_page(pfn)), count * PAGE_SIZE); > The pfn is returned by the

[PATCH v2] fb_defio: Remove custom address_space_operations

2021-03-10 Thread Matthew Wilcox (Oracle)
There's no need to give the page an address_space. Leaving the page->mapping as NULL will cause the VM to handle set_page_dirty() the same way that it's handled now, and that was the only reason to set the address_space in the first place. Signed-off-by: Matthew Wilcox (Oracle) Revie

Re: [PATCH] fb_defio: Remove custom address_space_operations

2021-03-10 Thread Matthew Wilcox
On Wed, Mar 10, 2021 at 06:38:07PM +, William Kucharski wrote: > Looks good, just one super minor nit inline. > > @@ -228,13 +202,6 @@ void fb_deferred_io_cleanup(struct fb_info *info) > > > > BUG_ON(!fbdefio); > > cancel_delayed_work_sync(>deferred_work); > > - > > - /* clear out

Re: [PATCH v2 00/10] fsdax,xfs: Add reflink support for fsdax

2021-03-10 Thread Matthew Wilcox
On Wed, Mar 10, 2021 at 08:21:59AM -0600, Goldwyn Rodrigues wrote: > On 13:02 10/03, Matthew Wilcox wrote: > > On Wed, Mar 10, 2021 at 07:30:41AM -0500, Neal Gompa wrote: > > > Forgive my ignorance, but is there a reason why this isn't wired up to > > > Btrfs at the same

Re: [PATCH v2 00/10] fsdax,xfs: Add reflink support for fsdax

2021-03-10 Thread Matthew Wilcox
On Wed, Mar 10, 2021 at 08:36:06AM -0500, Neal Gompa wrote: > On Wed, Mar 10, 2021 at 8:02 AM Matthew Wilcox wrote: > > > > On Wed, Mar 10, 2021 at 07:30:41AM -0500, Neal Gompa wrote: > > > Forgive my ignorance, but is there a reason why this isn't wired up to >

[PATCH] fb_defio: Remove custom address_space_operations

2021-03-10 Thread Matthew Wilcox (Oracle)
There's no need to give the page an address_space. Leaving the page->mapping as NULL will cause the VM to handle set_page_dirty() the same way that it's set now, and that was the only reason to set the address_space in the first place. Signed-off-by: Matthew Wilcox (Oracle) --- drivers/vi

Re: [PATCH v2] mm: page_alloc: dump migrate-failed pages

2021-03-10 Thread Matthew Wilcox
On Tue, Mar 09, 2021 at 10:32:51AM +0100, Michal Hocko wrote: > Apart from the above, do we have to warn for something that is a > debugging aid? A similar concern wrt dump_page which uses pr_warn and > page owner is using even pr_alert. > Would it make sense to add a loglevel parameter both into

Re: [PATCH v2 00/10] fsdax,xfs: Add reflink support for fsdax

2021-03-10 Thread Matthew Wilcox
On Wed, Mar 10, 2021 at 07:30:41AM -0500, Neal Gompa wrote: > Forgive my ignorance, but is there a reason why this isn't wired up to > Btrfs at the same time? It seems weird to me that adding a feature btrfs doesn't support DAX. only ext2, ext4, XFS and FUSE have DAX support. If you think about

Re: make alloc_anon_inode more useful

2021-03-09 Thread Matthew Wilcox
On Tue, Mar 09, 2021 at 04:53:39PM +0100, Christoph Hellwig wrote: > this series first renames the existing alloc_anon_inode to > alloc_anon_inode_sb to clearly mark it as requiring a superblock. > > It then adds a new alloc_anon_inode that works on the anon_inode > file system super block, thus

Re: mmotm 2021-03-08-21-52 uploaded

2021-03-09 Thread Matthew Wilcox
On Mon, Mar 08, 2021 at 09:52:55PM -0800, a...@linux-foundation.org wrote: > The mm-of-the-moment snapshot 2021-03-08-21-52 has been uploaded to > >https://www.ozlabs.org/~akpm/mmotm/ ... > This mmotm tree contains the following patches against 5.12-rc2: > (patches marked "*" will be included

[PATCH v2] include: Remove pagemap.h from blkdev.h

2021-03-09 Thread Matthew Wilcox (Oracle)
, but there may be implicit include problems on other architectures. Signed-off-by: Matthew Wilcox (Oracle) --- v2: Fix CONFIG_SWAP=n implicit use of pagemap.h by swap.h. Increases the number of files from 240, but that's still a big win -- 68% reduction instead of 77%. block/blk-settings.c

[PATCH] include: Remove pagemap.h from blkdev.h

2021-03-09 Thread Matthew Wilcox (Oracle)
, but there may be implicit include problems on other architectures. Signed-off-by: Matthew Wilcox (Oracle) --- block/blk-settings.c | 1 + drivers/block/brd.c | 1 + drivers/block/loop.c | 1 + drivers/md/bcache/super.c | 1 + drivers/nvdimm/btt.c | 1 + drivers/nvdimm/pmem.c

Re: [mm/filemap] cbd59c48ae: fxmark.hdd_ext4_no_jnl_DRBM_9_bufferedio.works/sec -7.6% regression

2021-03-09 Thread Matthew Wilcox
On Tue, Mar 09, 2021 at 03:57:06PM +0800, kernel test robot wrote: > FYI, we noticed a -7.6% regression of > fxmark.hdd_ext4_no_jnl_DRBM_9_bufferedio.works/sec due to commit: > > commit: cbd59c48ae2bcadc4a7599c29cf32fd3f9b78251 ("mm/filemap: use head pages > in generic_file_buffered_read") >

Re: [PATCH v5 1/8] mm: Remove special swap entry functions

2021-03-09 Thread Matthew Wilcox
On Tue, Mar 09, 2021 at 11:14:58PM +1100, Alistair Popple wrote: > -static inline struct page *migration_entry_to_page(swp_entry_t entry) > -{ > - struct page *p = pfn_to_page(swp_offset(entry)); > - /* > - * Any use of migration entries may only occur while the > - *

Re: [PATCH v2 2/2] mm/memcg: set memcg when split page

2021-03-09 Thread Matthew Wilcox
On Tue, Mar 09, 2021 at 10:02:00AM +0100, Michal Hocko wrote: > On Mon 08-03-21 21:02:25, Matthew Wilcox wrote: > > On Thu, Mar 04, 2021 at 07:40:53AM +, Zhou Guanghui wrote: > > > For example, when alloc_pages_exact is used to allocate 1MB continuous > > > phys

Re: [LTP] [f2fs] 02eb84b96b: ltp.swapon03.fail

2021-03-08 Thread Matthew Wilcox
On Tue, Mar 09, 2021 at 10:23:35AM +0800, Weichao Guo wrote: > Hi Richard, > > On 2021/3/8 19:53, Richard Palethorpe wrote: > > Hello, > > > > > kern :err : [ 187.461914] F2FS-fs (sda1): Swapfile does not align to > > > section > > > commit 02eb84b96bc1b382dd138bf60724edbefe77b025 > > >

Re: Metadata writtenback notification? -- was Re: fscache: Redesigning the on-disk cache

2021-03-08 Thread Matthew Wilcox
On Tue, Mar 09, 2021 at 09:32:47AM +1100, Dave Chinner wrote: > On Mon, Mar 08, 2021 at 11:28:41AM +, David Howells wrote: > > Possibly it's sufficient to just clear the excess page space before > > writing, but that doesn't necessarily stop a writable mmap from > > scribbling

Re: [PATCH v2 2/2] mm/memcg: set memcg when split page

2021-03-08 Thread Matthew Wilcox
On Thu, Mar 04, 2021 at 07:40:53AM +, Zhou Guanghui wrote: > As described in the split_page function comment, for the non-compound > high order page, the sub-pages must be freed individually. If the > memcg of the fisrt page is valid, the tail pages cannot be uncharged > when be freed. > >

Re: [PATCH v2 2/2] mm/memcg: set memcg when split page

2021-03-08 Thread Matthew Wilcox
On Mon, Mar 08, 2021 at 12:42:27PM -0800, Andrew Morton wrote: > On Mon, 8 Mar 2021 09:41:38 +0100 Michal Hocko wrote: > > > On Fri 05-03-21 15:58:40, Andrew Morton wrote: > > > On Fri, 5 Mar 2021 12:52:52 +0100 Michal Hocko wrote: > > > > > > > On Thu 04-03-21 07:40:53, Zhou Guanghui wrote: >

Re: [PATCH v2] Expose the bus kernel docs to the build docs.

2021-03-06 Thread Matthew Wilcox
On Sat, Mar 06, 2021 at 07:12:19PM -0800, Wren Turkal wrote: > +Fucntions and Structures Typo, but hold off on a v3 until someone weighs in with an opinion on the rest of the patch.

Re: [PATCH] Expose the bus kernel docs to the build docs.

2021-03-06 Thread Matthew Wilcox
On Sat, Mar 06, 2021 at 05:33:01PM -0800, Wren Turkal wrote: > Before, the bus type related APIs that were defined in the > include/linux/device/bus.h were not referenced anywhere in the docs, so > I linked it to the bus types api documentation. I think this is a good thing to do. > +++

<    1   2   3   4   5   6   7   8   9   10   >