Re: [RFC][PATCH v2] splice: Prevent gifting of multipage folios

2023-02-27 Thread Matthew Wilcox
to pass in gift pages") > Signed-off-by: David Howells > cc: Matthew Wilcox Reviewed-by: Matthew Wilcox (Oracle) Cc: sta...@vger.kernel.org > cc: Jens Axboe > cc: Miklos Szeredi > cc: Amit Shah > cc: linux-fsde...@vger.kernel.org > cc: virtualization@lists.linux-foundati

Re: [RFC][PATCH] splice: Prevent gifting of multipage folios

2023-02-27 Thread Matthew Wilcox
already possible with THPs (both anon and tmpfs backed) long before I introduced folios. > cc: Matthew Wilcox > cc: Miklos Szeredi > cc: Amit Shah > cc: linux-fsde...@vger.kernel.org > cc: virtualization@lists.linux-foundation.org > cc: linux...@kvack.org > --- > fs/splice

Re: [PATCH 01/23] block: factor out a bvec_set_page helper

2023-01-30 Thread Matthew Wilcox
On Tue, Jan 31, 2023 at 05:00:32AM +, Matthew Wilcox wrote: > On Mon, Jan 30, 2023 at 08:47:58PM -0800, Jakub Kicinski wrote: > > kinda random thought but since we're touching this area - could we > > perhaps move the definition of struct bio_vec and trivial helpers >

Re: [PATCH 01/23] block: factor out a bvec_set_page helper

2023-01-30 Thread Matthew Wilcox
On Mon, Jan 30, 2023 at 08:47:58PM -0800, Jakub Kicinski wrote: > kinda random thought but since we're touching this area - could we > perhaps move the definition of struct bio_vec and trivial helpers > like this into a new header? bvec.h pulls in mm.h which is a right > behemoth :S I bet we can

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-26 Thread Matthew Wilcox
On Thu, Jan 26, 2023 at 04:50:59PM +0200, Mike Rapoport wrote: > On Thu, Jan 26, 2023 at 11:17:09AM +0200, Mike Rapoport wrote: > > On Wed, Jan 25, 2023 at 12:38:46AM -0800, Suren Baghdasaryan wrote: > > > +/* Use when VMA is not part of the VMA tree and needs no locking */ > > > +static inline voi

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Matthew Wilcox
On Wed, Jan 25, 2023 at 08:49:50AM -0800, Suren Baghdasaryan wrote: > On Wed, Jan 25, 2023 at 1:10 AM Peter Zijlstra wrote: > > > + /* > > > + * Flags, see mm.h. > > > + * WARNING! Do not modify directly. > > > + * Use {init|reset|set|clear|mod}_vm_flags() functions instead. > >

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Matthew Wilcox
On Wed, Jan 25, 2023 at 12:38:46AM -0800, Suren Baghdasaryan wrote: > +/* Use when VMA is not part of the VMA tree and needs no locking */ > +static inline void init_vm_flags(struct vm_area_struct *vma, > + unsigned long flags) > +{ > + vma->vm_flags = flags; vm_fl

Re: [PATCH] docs: driver-api: virtio: virtio on Linux

2022-08-03 Thread Matthew Wilcox
On Wed, Aug 03, 2022 at 09:24:49AM +0200, Ricardo Cañuelo wrote: > Hi Matthew, > > On mar, ago 02 2022 at 16:56:48, Matthew Wilcox wrote: > > You don't need to use :c:func:`foo`. You can just write foo() and the > > tooling will convert it into :c:func:`foo` for yo

Re: [PATCH] docs: driver-api: virtio: virtio on Linux

2022-08-02 Thread Matthew Wilcox
On Tue, Aug 02, 2022 at 02:42:22PM +0200, Ricardo Cañuelo wrote: > +In this case, when the interrupt arrives :c:func:`vp_interrupt` will be > +called and it will ultimately lead to a call to > +:c:func:`vring_interrupt`, which ends up calling the virtqueue callback > +function:: You don't need to

Re: [PATCH v2 07/19] mm/migrate: Convert expected_page_refs() to folio_expected_refs()

2022-07-07 Thread Matthew Wilcox
On Thu, Jul 07, 2022 at 07:50:17PM -0700, Hugh Dickins wrote: > On Wed, 8 Jun 2022, Matthew Wilcox (Oracle) wrote: > > > Now that both callers have a folio, convert this function to > > take a folio & rename it. > > > > Signed-off-by: Matthew Wilcox (Oracle)

Re: [PATCH v2 12/19] btrfs: Convert btrfs_migratepage to migrate_folio

2022-06-09 Thread Matthew Wilcox
On Thu, Jun 09, 2022 at 06:33:23PM +0200, David Sterba wrote: > On Wed, Jun 08, 2022 at 04:02:42PM +0100, Matthew Wilcox (Oracle) wrote: > > Use filemap_migrate_folio() to do the bulk of the work, and then copy > > the ordered flag across if needed. > > > > Signed-off

Re: [PATCH v2 03/19] fs: Add aops->migrate_folio

2022-06-09 Thread Matthew Wilcox
On Thu, Jun 09, 2022 at 02:50:20PM +0200, David Hildenbrand wrote: > On 08.06.22 17:02, Matthew Wilcox (Oracle) wrote: > > diff --git a/Documentation/filesystems/locking.rst > > b/Documentation/filesystems/locking.rst > > index c0fe711f14d3..3d28b23676bd 100644 > > ---

[PATCH v2 07/19] mm/migrate: Convert expected_page_refs() to folio_expected_refs()

2022-06-08 Thread Matthew Wilcox (Oracle)
Now that both callers have a folio, convert this function to take a folio & rename it. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- mm/migrate.c | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mm/migrate.c b/mm/migra

[PATCH v2 16/19] hugetlb: Convert to migrate_folio

2022-06-08 Thread Matthew Wilcox (Oracle)
This involves converting migrate_huge_page_move_mapping(). We also need a folio variant of hugetlb_set_page_subpool(), but that's for a later patch. Signed-off-by: Matthew Wilcox (Oracle) --- fs/hugetlbfs/inode.c| 23 ++- include/linux/migrate.h | 6 +++--

[PATCH v2 09/19] nfs: Convert to migrate_folio

2022-06-08 Thread Matthew Wilcox (Oracle)
Use a folio throughout this function. migrate_page() will be converted later. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Anna Schumaker Reviewed-by: Christoph Hellwig --- fs/nfs/file.c | 4 +--- fs/nfs/internal.h | 6 -- fs/nfs/write.c| 16 3 files

[PATCH v2 06/19] mm/migrate: Convert buffer_migrate_page() to buffer_migrate_folio()

2022-06-08 Thread Matthew Wilcox (Oracle)
Use a folio throughout __buffer_migrate_folio(), add kernel-doc for buffer_migrate_folio() and buffer_migrate_folio_norefs(), move their declarations to buffer.h and switch all filesystems that have wired them up. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- block

[PATCH v2 14/19] f2fs: Convert to filemap_migrate_folio()

2022-06-08 Thread Matthew Wilcox (Oracle)
filemap_migrate_folio() fits f2fs's needs perfectly. Signed-off-by: Matthew Wilcox (Oracle) --- fs/f2fs/checkpoint.c | 4 +--- fs/f2fs/data.c | 40 +--- fs/f2fs/f2fs.h | 4 fs/f2fs/node.c | 4 +--- 4 files changed, 3 inser

[PATCH v2 19/19] mm/folio-compat: Remove migration compatibility functions

2022-06-08 Thread Matthew Wilcox (Oracle)
migrate_page_move_mapping(), migrate_page_copy() and migrate_page_states() are all now unused after converting all the filesystems from aops->migratepage() to aops->migrate_folio(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- include/linux/migrate.

[PATCH v2 05/19] mm/migrate: Convert writeout() to take a folio

2022-06-08 Thread Matthew Wilcox (Oracle)
Use a folio throughout this function. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- mm/migrate.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 1878de817a01..6b6fec26f4d0 100644 --- a/mm

[PATCH v2 02/19] mm: Convert all PageMovable users to movable_operations

2022-06-08 Thread Matthew Wilcox (Oracle)
These drivers are rather uncomfortably hammered into the address_space_operations hole. They aren't filesystems and don't behave like filesystems. They just need their own movable_operations structure, which we can point to directly from page->mapping. Signed-off-by: Matthew W

[PATCH v2 13/19] ubifs: Convert to filemap_migrate_folio()

2022-06-08 Thread Matthew Wilcox (Oracle)
filemap_migrate_folio() is a little more general than ubifs really needs, but it's better to share the code. Signed-off-by: Matthew Wilcox (Oracle) --- fs/ubifs/file.c | 29 ++--- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/fs/ubifs/file.c b/fs/

[PATCH v2 08/19] btrfs: Convert btree_migratepage to migrate_folio

2022-06-08 Thread Matthew Wilcox (Oracle)
Use a folio throughout this function. migrate_page() will be converted later. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/btrfs/disk-io.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs

[PATCH v2 00/19] Convert aops->migratepage to aops->migrate_folio

2022-06-08 Thread Matthew Wilcox (Oracle)
p the conversions of balloon, zsmalloc and z3fold - Fix the build errors with hugetlbfs - Fix the kerneldoc errors - Fix the ;; typo Matthew Wilcox (Oracle) (19): secretmem: Remove isolate_page mm: Convert all PageMovable users to movable_operations fs: Add aops->migrate_foli

[PATCH v2 10/19] mm/migrate: Convert migrate_page() to migrate_folio()

2022-06-08 Thread Matthew Wilcox (Oracle)
Convert all callers to pass a folio. Most have the folio already available. Switch all users from aops->migratepage to aops->migrate_folio. Also turn the documentation into kerneldoc. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- drivers/gpu/drm/i9

[PATCH v2 03/19] fs: Add aops->migrate_folio

2022-06-08 Thread Matthew Wilcox (Oracle)
Provide a folio-based replacement for aops->migratepage. Update the documentation to document migrate_folio instead of migratepage. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- Documentation/filesystems/locking.rst | 5 ++-- Documentation/filesystems/vfs.

[PATCH v2 18/19] fs: Remove aops->migratepage()

2022-06-08 Thread Matthew Wilcox (Oracle)
With all users converted to migrate_folio(), remove this operation. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- include/linux/fs.h | 2 -- mm/compaction.c| 5 ++--- mm/migrate.c | 3 --- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a

[PATCH v2 12/19] btrfs: Convert btrfs_migratepage to migrate_folio

2022-06-08 Thread Matthew Wilcox (Oracle)
Use filemap_migrate_folio() to do the bulk of the work, and then copy the ordered flag across if needed. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/btrfs/inode.c | 26 +- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/fs

[PATCH v2 15/19] aio: Convert to migrate_folio

2022-06-08 Thread Matthew Wilcox (Oracle)
Use a folio throughout this function. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/aio.c | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 3c249b938632..a1911e86859c 100644 --- a

[PATCH v2 01/19] secretmem: Remove isolate_page

2022-06-08 Thread Matthew Wilcox (Oracle)
The isolate_page operation is never called for filesystems, only for device drivers which call SetPageMovable. Signed-off-by: Matthew Wilcox (Oracle) --- mm/secretmem.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/mm/secretmem.c b/mm/secretmem.c index 206ed6b40c1d..1c7f1775b56e

[PATCH v2 11/19] mm/migrate: Add filemap_migrate_folio()

2022-06-08 Thread Matthew Wilcox (Oracle)
There is nothing iomap-specific about iomap_migratepage(), and it fits a pattern used by several other filesystems, so move it to mm/migrate.c, convert it to be filemap_migrate_folio() and convert the iomap filesystems to use it. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph

[PATCH v2 04/19] mm/migrate: Convert fallback_migrate_page() to fallback_migrate_folio()

2022-06-08 Thread Matthew Wilcox (Oracle)
Use a folio throughout. migrate_page() will be converted to migrate_folio() later. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- mm/migrate.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index

[PATCH v2 17/19] secretmem: Convert to migrate_folio

2022-06-08 Thread Matthew Wilcox (Oracle)
This is little more than changing the types over; there's no real work being done in this function. Signed-off-by: Matthew Wilcox (Oracle) --- mm/secretmem.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/secretmem.c b/mm/secretmem.c index 1c7f177

Re: [PATCH 15/20] balloon: Convert to migrate_folio

2022-06-07 Thread Matthew Wilcox
On Tue, Jun 07, 2022 at 03:24:15PM +0100, Matthew Wilcox wrote: > On Tue, Jun 07, 2022 at 09:36:21AM +0200, David Hildenbrand wrote: > > On 06.06.22 22:40, Matthew Wilcox (Oracle) wrote: > > > const struct address_space_operations balloon_aops = { > > > - .migrate

Re: [PATCH 14/20] hugetlb: Convert to migrate_folio

2022-06-07 Thread Matthew Wilcox
On Tue, Jun 07, 2022 at 02:13:26PM +0800, kernel test robot wrote: >fs/hugetlbfs/inode.c: In function 'hugetlbfs_migrate_folio': > >> fs/hugetlbfs/inode.c:990:17: error: implicit declaration of function > >> 'folio_migrate_copy' [-Werror=implicit-function-declaration] > 990 |

Re: [PATCH 04/20] mm/migrate: Convert buffer_migrate_page() to buffer_migrate_folio()

2022-06-07 Thread Matthew Wilcox
On Tue, Jun 07, 2022 at 11:37:45AM +0800, kernel test robot wrote: > All warnings (new ones prefixed by >>): > > >> mm/migrate.c:775: warning: expecting prototype for > >> buffer_migrate_folio_noref(). Prototype was for > >> buffer_migrate_folio_norefs() instead No good deed (turning documentat

Re: [PATCH 15/20] balloon: Convert to migrate_folio

2022-06-07 Thread Matthew Wilcox
On Tue, Jun 07, 2022 at 09:36:21AM +0200, David Hildenbrand wrote: > On 06.06.22 22:40, Matthew Wilcox (Oracle) wrote: > > const struct address_space_operations balloon_aops = { > > - .migratepage = balloon_page_migrate, > > + .migrate_folio = balloon_migrate_folio,

Re: [PATCH 05/20] mm/migrate: Convert expected_page_refs() to folio_expected_refs()

2022-06-07 Thread Matthew Wilcox
On Tue, Jun 07, 2022 at 09:41:57AM -0400, Brian Foster wrote: > On Mon, Jun 06, 2022 at 09:40:35PM +0100, Matthew Wilcox (Oracle) wrote: > > -static int expected_page_refs(struct address_space *mapping, struct page > > *page) > > +static int folio_expected_refs(struct a

[PATCH 14/20] hugetlb: Convert to migrate_folio

2022-06-06 Thread Matthew Wilcox (Oracle)
This involves converting migrate_huge_page_move_mapping(). We also need a folio variant of hugetlb_set_page_subpool(), but that's for a later patch. Signed-off-by: Matthew Wilcox (Oracle) --- fs/hugetlbfs/inode.c| 19 ++- include/linux/migrate.h | 6 +++--- mm/migr

[PATCH 05/20] mm/migrate: Convert expected_page_refs() to folio_expected_refs()

2022-06-06 Thread Matthew Wilcox (Oracle)
Now that both callers have a folio, convert this function to take a folio & rename it. Signed-off-by: Matthew Wilcox (Oracle) --- mm/migrate.c | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 77b8c662c9ca..e0a593e5

[PATCH 00/20] Convert aops->migratepage to aops->migrate_folio

2022-06-06 Thread Matthew Wilcox (Oracle)
t it now, but it's little more than compile tested for other filesystems. Matthew Wilcox (Oracle) (20): fs: Add aops->migrate_folio mm/migrate: Convert fallback_migrate_page() to fallback_migrate_folio() mm/migrate: Convert writeout() to take a folio mm/migrate: Conver

[PATCH 07/20] nfs: Convert to migrate_folio

2022-06-06 Thread Matthew Wilcox (Oracle)
Use a folio throughout this function. migrate_page() will be converted later. Signed-off-by: Matthew Wilcox (Oracle) --- fs/nfs/file.c | 4 +--- fs/nfs/internal.h | 6 -- fs/nfs/write.c| 16 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/fs/nfs

[PATCH 16/20] secretmem: Convert to migrate_folio

2022-06-06 Thread Matthew Wilcox (Oracle)
This is little more than changing the types over; there's no real work being done in this function. Signed-off-by: Matthew Wilcox (Oracle) --- mm/secretmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/secretmem.c b/mm/secretmem.c index 206ed6b

[PATCH 15/20] balloon: Convert to migrate_folio

2022-06-06 Thread Matthew Wilcox (Oracle)
This is little more than changing the types over; there's no real work being done in this function. Signed-off-by: Matthew Wilcox (Oracle) --- mm/balloon_compaction.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mm/balloon_compaction.c

[PATCH 20/20] mm/folio-compat: Remove migration compatibility functions

2022-06-06 Thread Matthew Wilcox (Oracle)
migrate_page_move_mapping(), migrate_page_copy() and migrate_page_states() are all now unused after converting all the filesystems from aops->migratepage() to aops->migrate_folio(). Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/migrate.h | 11 --- mm/folio-compat.c

[PATCH 06/20] btrfs: Convert btree_migratepage to migrate_folio

2022-06-06 Thread Matthew Wilcox (Oracle)
Use a folio throughout this function. migrate_page() will be converted later. Signed-off-by: Matthew Wilcox (Oracle) --- fs/btrfs/disk-io.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 12b11e645c14

[PATCH 08/20] mm/migrate: Convert migrate_page() to migrate_folio()

2022-06-06 Thread Matthew Wilcox (Oracle)
Convert all callers to pass a folio. Most have the folio already available. Switch all users from aops->migratepage to aops->migrate_folio. Also turn the documentation into kerneldoc. Signed-off-by: Matthew Wilcox (Oracle) --- drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 4 +-- fs

[PATCH 10/20] btrfs: Convert btrfs_migratepage to migrate_folio

2022-06-06 Thread Matthew Wilcox (Oracle)
Use filemap_migrate_folio() to do the bulk of the work, and then copy the ordered flag across if needed. Signed-off-by: Matthew Wilcox (Oracle) --- fs/btrfs/inode.c | 26 +- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs

[PATCH 03/20] mm/migrate: Convert writeout() to take a folio

2022-06-06 Thread Matthew Wilcox (Oracle)
Use a folio throughout this function. Signed-off-by: Matthew Wilcox (Oracle) --- mm/migrate.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index d772ce63d7e2..f19246c12fe9 100644 --- a/mm/migrate.c +++ b/mm/migrate.c

[PATCH 02/20] mm/migrate: Convert fallback_migrate_page() to fallback_migrate_folio()

2022-06-06 Thread Matthew Wilcox (Oracle)
Use a folio throughout. migrate_page() will be converted to migrate_folio() later. Signed-off-by: Matthew Wilcox (Oracle) --- mm/migrate.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 75cb6aa38988..d772ce63d7e2

[PATCH 01/20] fs: Add aops->migrate_folio

2022-06-06 Thread Matthew Wilcox (Oracle)
Provide a folio-based replacement for aops->migratepage. Update the documentation to document migrate_folio instead of migratepage. Signed-off-by: Matthew Wilcox (Oracle) --- Documentation/filesystems/locking.rst | 5 ++-- Documentation/filesystems/vfs.rst | 13 ++- Documentat

[PATCH 04/20] mm/migrate: Convert buffer_migrate_page() to buffer_migrate_folio()

2022-06-06 Thread Matthew Wilcox (Oracle)
Use a folio throughout __buffer_migrate_folio(), add kernel-doc for buffer_migrate_folio() and buffer_migrate_folio_norefs(), move their declarations to buffer.h and switch all filesystems that have wired them up. Signed-off-by: Matthew Wilcox (Oracle) --- block/fops.c| 2

[PATCH 09/20] mm/migrate: Add filemap_migrate_folio()

2022-06-06 Thread Matthew Wilcox (Oracle)
There is nothing iomap-specific about iomap_migratepage(), and it fits a pattern used by several other filesystems, so move it to mm/migrate.c, convert it to be filemap_migrate_folio() and convert the iomap filesystems to use it. Signed-off-by: Matthew Wilcox (Oracle) --- fs/gfs2/aops.c

[PATCH 19/20] fs: Remove aops->migratepage()

2022-06-06 Thread Matthew Wilcox (Oracle)
With all users converted to migrate_folio(), remove this operation. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/fs.h | 2 -- mm/compaction.c| 5 ++--- mm/migrate.c | 10 +- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/include/linux/fs.h b

[PATCH 12/20] f2fs: Convert to filemap_migrate_folio()

2022-06-06 Thread Matthew Wilcox (Oracle)
filemap_migrate_folio() fits f2fs's needs perfectly. Signed-off-by: Matthew Wilcox (Oracle) --- fs/f2fs/checkpoint.c | 4 +--- fs/f2fs/data.c | 40 +--- fs/f2fs/f2fs.h | 4 fs/f2fs/node.c | 4 +--- 4 files changed, 3 inser

[PATCH 17/20] z3fold: Convert to migrate_folio

2022-06-06 Thread Matthew Wilcox (Oracle)
z3fold doesn't really use folios, but it needs to be called like this in order to migrate an individual page. Convert from a folio back to a page until we decide how to handle migration better for z3fold. Signed-off-by: Matthew Wilcox (Oracle) --- mm/z3fold.c | 8 +--- 1 file chang

[PATCH 13/20] aio: Convert to migrate_folio

2022-06-06 Thread Matthew Wilcox (Oracle)
Use a folio throughout this function. Signed-off-by: Matthew Wilcox (Oracle) --- fs/aio.c | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 3c249b938632..a1911e86859c 100644 --- a/fs/aio.c +++ b/fs/aio.c

[PATCH 11/20] ubifs: Convert to filemap_migrate_folio()

2022-06-06 Thread Matthew Wilcox (Oracle)
filemap_migrate_folio() is a little more general than ubifs really needs, but it's better to share the code. Signed-off-by: Matthew Wilcox (Oracle) --- fs/ubifs/file.c | 29 ++--- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/fs/ubifs/file.c b/fs/

[PATCH 18/20] zsmalloc: Convert to migrate_folio

2022-06-06 Thread Matthew Wilcox (Oracle)
zsmalloc doesn't really use folios, but it needs to be called like this in order to migrate an individual page. Convert from a folio back to a page until we decide how to handle migration better for zsmalloc. Signed-off-by: Matthew Wilcox (Oracle) --- mm/zsmalloc.c | 8 +--- 1 file ch

Re: [linux-next:master] BUILD REGRESSION 8cb8311e95e3bb58bd84d6350365f14a718faa6d

2022-05-26 Thread Matthew Wilcox
On Thu, May 26, 2022 at 11:48:32AM +0300, Dan Carpenter wrote: > On Thu, May 26, 2022 at 02:16:34AM +0100, Matthew Wilcox wrote: > > Bizarre this started showing up now. The recent patch was: > > > > - info->alloced += compound_nr(page); > > - inod

Re: [linux-next:master] BUILD REGRESSION 8cb8311e95e3bb58bd84d6350365f14a718faa6d

2022-05-25 Thread Matthew Wilcox
On Wed, May 25, 2022 at 03:20:06PM -0700, Andrew Morton wrote: > On Wed, 25 May 2022 23:07:35 +0100 Jessica Clarke wrote: > > > This is i386, so an unsigned long is 32-bit, but i_blocks is a blkcnt_t > > i.e. a u64, which makes the shift without a cast of the LHS fishy. > > Ah, of course, thanks

Re: [PATCH] tools/virtio: Test virtual address range detection

2022-03-16 Thread Matthew Wilcox
On Tue, Feb 22, 2022 at 11:18:18PM +, Matthew Wilcox wrote: > On Tue, Feb 22, 2022 at 07:58:33AM +, David Woodhouse wrote: > > On Tue, 2022-02-22 at 01:31 -0500, Michael S. Tsirkin wrote: > > > On Mon, Feb 21, 2022 at 05:18:48PM +, David Woodhouse wrote: > > &

Re: [PATCH] tools/virtio: Test virtual address range detection

2022-02-25 Thread Matthew Wilcox
On Tue, Feb 22, 2022 at 11:18:18PM +, Matthew Wilcox wrote: > On Tue, Feb 22, 2022 at 07:58:33AM +, David Woodhouse wrote: > > On Tue, 2022-02-22 at 01:31 -0500, Michael S. Tsirkin wrote: > > > On Mon, Feb 21, 2022 at 05:18:48PM +, David Woodhouse wrote: > > &

Re: [PATCH] tools/virtio: Test virtual address range detection

2022-02-22 Thread Matthew Wilcox
In mine linux/uio.h does not > > include linux/mm_types.h. > > Strictly it's > https://git.infradead.org/users/dwmw2/linux.git/shortlog/refs/heads/xen-evtchn-kernel > but I'm sure my part isn't relevant; it's just v5.17-rc5. > > $ git blame include/linu

Re: futher decouple DAX from block devices

2021-11-04 Thread Matthew Wilcox
On Thu, Nov 04, 2021 at 11:09:19PM -0400, Theodore Ts'o wrote: > On Thu, Nov 04, 2021 at 12:04:43PM -0700, Darrick J. Wong wrote: > > > Note that I've avoided implementing read/write fops for dax devices > > > partly out of concern for not wanting to figure out shared-mmap vs > > > write coherence

Re: [RFC v1 7/8] mshv: implement in-kernel device framework

2021-07-09 Thread Matthew Wilcox
On Fri, Jul 09, 2021 at 07:14:05PM +, Wei Liu wrote: > You were not CC'ed on this patch, so presumably you got it via one of > the mailing lists. I'm not sure why you only got this one patch. Perhaps > if you wait a bit you will get the rest. No, I won't. You only cc'd linux-doc on this one p

Re: [RFC v1 7/8] mshv: implement in-kernel device framework

2021-07-09 Thread Matthew Wilcox
On Fri, Jul 09, 2021 at 04:27:32PM +, Wei Liu wrote: > > Then don't define your own structure. Use theirs. > > I specifically mentioned in the cover letter I didn't do it because I > was not sure if that would be acceptable. I guess I will find out. I only got patch 7/8. You can't blame me

Re: [RFC v1 7/8] mshv: implement in-kernel device framework

2021-07-09 Thread Matthew Wilcox
On Fri, Jul 09, 2021 at 01:50:13PM +, Wei Liu wrote: > On Fri, Jul 09, 2021 at 02:02:04PM +0100, Matthew Wilcox wrote: > > On Fri, Jul 09, 2021 at 11:43:38AM +, Wei Liu wrote: > > > +static long > > > +mshv_partition_ioctl_create_device(struct mshv_partition *par

Re: [RFC v1 7/8] mshv: implement in-kernel device framework

2021-07-09 Thread Matthew Wilcox
On Fri, Jul 09, 2021 at 11:43:38AM +, Wei Liu wrote: > +static long > +mshv_partition_ioctl_create_device(struct mshv_partition *partition, > + void __user *user_args) > +{ [...] > + mshv_partition_get(partition); > + r = anon_inode_getfd(ops->name, &mshv_device_fops, dev, O_RDWR |

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 r

Re: [RFC v2 PATCH 4/4] mm: pre zero out free pages to speed up page allocation for __GFP_ZERO

2021-01-04 Thread Matthew Wilcox
On Mon, Jan 04, 2021 at 11:19:13AM -0800, Dave Hansen wrote: > On 12/21/20 8:30 AM, Liang Li wrote: > > --- a/include/linux/page-flags.h > > +++ b/include/linux/page-flags.h > > @@ -137,6 +137,9 @@ enum pageflags { > > #endif > > #ifdef CONFIG_64BIT > > PG_arch_2, > > +#endif > > +#ifdef CONF

Re: [RFC v2 PATCH 0/4] speed up page allocation for __GFP_ZERO

2020-12-22 Thread Matthew Wilcox
On Mon, Dec 21, 2020 at 11:25:22AM -0500, Liang Li wrote: > Creating a VM [64G RAM, 32 CPUs] with GPU passthrough > = > QEMU use 4K pages, THP is off > round1 round2 round3 > w/o this patch:23.5s 24.7s 2

Re: [PATCH v2 1/8] mm: slab: provide krealloc_array()

2020-11-02 Thread Matthew Wilcox
On Mon, Nov 02, 2020 at 04:20:30PM +0100, Bartosz Golaszewski wrote: > +Chunks allocated with `kmalloc` can be resized with `krealloc`. Similarly > +to `kmalloc_array`: a helper for resising arrays is provided in the form of > +`krealloc_array`. Is there any reason you chose to `do_this` instead o

Re: [RFC 1/4] mm: export zap_page_range() for driver use

2020-10-19 Thread Matthew Wilcox
On Mon, Oct 19, 2020 at 10:56:20PM +0800, Xie Yongji wrote: > Export zap_page_range() for use in VDUSE. I think you're missing a lot of MMU notifier work by calling this directly. It probably works in every scenario you've tested, but won't work for others. I see you're using VM_MIXEDMAP -- woul

Re: [Ocfs2-devel] [RFC] treewide: cleanup unreachable breaks

2020-10-18 Thread Matthew Wilcox
On Sun, Oct 18, 2020 at 12:13:35PM -0700, James Bottomley wrote: > On Sun, 2020-10-18 at 19:59 +0100, Matthew Wilcox wrote: > > On Sat, Oct 17, 2020 at 09:09:28AM -0700, t...@redhat.com wrote: > > > clang has a number of useful, new warnings see > > > https:

Re: [Ocfs2-devel] [RFC] treewide: cleanup unreachable breaks

2020-10-18 Thread Matthew Wilcox
On Sat, Oct 17, 2020 at 09:09:28AM -0700, t...@redhat.com wrote: > clang has a number of useful, new warnings see > https://urldefense.com/v3/__https://clang.llvm.org/docs/DiagnosticsReference.html__;!!GqivPVa7Brio!Krxz78O3RKcB9JBMVo_F98FupVhj_jxX60ddN6tKGEbv_cnooXc1nnBmchm-e_O9ieGnyQ$ > Please

Re: [PATCH v4 0/3] mm, treewide: Rename kzfree() to kfree_sensitive()

2020-06-17 Thread Matthew Wilcox
On Wed, Jun 17, 2020 at 01:31:57PM +0200, Michal Hocko wrote: > On Wed 17-06-20 04:08:20, Matthew Wilcox wrote: > > If you call vfree() under > > a spinlock, you're in trouble. in_atomic() only knows if we hold a > > spinlock for CONFIG_PREEMPT, so it's not safe

Re: [PATCH v4 0/3] mm, treewide: Rename kzfree() to kfree_sensitive()

2020-06-17 Thread Matthew Wilcox
On Wed, Jun 17, 2020 at 09:12:12AM +0200, Michal Hocko wrote: > On Tue 16-06-20 17:37:11, Matthew Wilcox wrote: > > Not just performance critical, but correctness critical. Since kvfree() > > may allocate from the vmalloc allocator, I really think that kvfree() > > sh

Re: [PATCH v4 0/3] mm, treewide: Rename kzfree() to kfree_sensitive()

2020-06-16 Thread Matthew Wilcox
On Wed, Jun 17, 2020 at 01:01:30AM +0200, David Sterba wrote: > On Tue, Jun 16, 2020 at 11:53:50AM -0700, Joe Perches wrote: > > On Mon, 2020-06-15 at 21:57 -0400, Waiman Long wrote: > > > v4: > > > - Break out the memzero_explicit() change as suggested by Dan Carpenter > > > so that it can

Re: [PATCH v4 0/3] mm, treewide: Rename kzfree() to kfree_sensitive()

2020-06-16 Thread Matthew Wilcox
On Tue, Jun 16, 2020 at 11:53:50AM -0700, Joe Perches wrote: > To this larger audience and last week without reply: > https://lore.kernel.org/lkml/573b3fbd5927c643920e1364230c296b23e7584d.ca...@perches.com/ > > Are there _any_ fastpath uses of kfree or vfree? I worked on adding a 'free' a couple

Re: [PATCH 1/2] docs: mm/gup: pin_user_pages.rst: add a "case 5"

2020-06-12 Thread Matthew Wilcox
On Fri, May 29, 2020 at 04:43:08PM -0700, John Hubbard wrote: > +CASE 5: Pinning in order to write to the data within the page > +- > +Even though neither DMA nor Direct IO is involved, just a simple case of > "pin, > +access page's data,

Re: improve use_mm / unuse_mm v2

2020-04-16 Thread Matthew Wilcox
On Thu, Apr 16, 2020 at 07:31:55AM +0200, Christoph Hellwig wrote: > this series improves the use_mm / unuse_mm interface by better > documenting the assumptions, and my taking the set_fs manipulations > spread over the callers into the core API. I appreciate all the work you're doing here. Do yo

Re: DANGER WILL ROBINSON, DANGER

2019-08-13 Thread Matthew Wilcox
On Tue, Aug 13, 2019 at 11:29:07AM +0200, Paolo Bonzini wrote: > On 09/08/19 18:24, Matthew Wilcox wrote: > > On Fri, Aug 09, 2019 at 07:00:26PM +0300, Adalbert Lazăr wrote: > >> +++ b/include/linux/page-flags.h > >> @@ -417,8 +417,10 @@ PAGEFLAG(Idle, idle, PF_A

DANGER WILL ROBINSON, DANGER

2019-08-09 Thread Matthew Wilcox
On Fri, Aug 09, 2019 at 07:00:26PM +0300, Adalbert Lazăr wrote: > +++ b/include/linux/page-flags.h > @@ -417,8 +417,10 @@ PAGEFLAG(Idle, idle, PF_ANY) > */ > #define PAGE_MAPPING_ANON0x1 > #define PAGE_MAPPING_MOVABLE 0x2 > +#define PAGE_MAPPING_REMOTE 0x4 Uh. How do you know page->mappi

Re: [PATCH v3 0/5] kvm "virtio pmem" device

2019-01-16 Thread Matthew Wilcox
On Mon, Jan 14, 2019 at 10:29:02AM +1100, Dave Chinner wrote: > Until you have images (and hence host page cache) shared between > multiple guests. People will want to do this, because it means they > only need a single set of pages in host memory for executable > binaries rather than a set of page

Re: [PATCH RFC 3/4] barriers: convert a control to a data dependency

2019-01-02 Thread Matthew Wilcox
On Wed, Jan 02, 2019 at 03:57:58PM -0500, Michael S. Tsirkin wrote: > @@ -875,6 +893,8 @@ to the CPU containing it. See the section on "Multicopy > atomicity" > for more information. > > > + > + > In summary: > >(*) Control dependencies can order prior loads against later stores. Was

[PATCH v2 2/2] drm/virtio: Use IDAs more efficiently

2018-10-30 Thread Matthew Wilcox
0-based IDAs are more efficient than any other base. Convert the 1-based IDAs to be 0-based. Signed-off-by: Matthew Wilcox --- drivers/gpu/drm/virtio/virtgpu_kms.c| 5 +++-- drivers/gpu/drm/virtio/virtgpu_object.c | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a

[PATCH v2 1/2] drm/virtio: Handle error from virtio_gpu_resource_id_get

2018-10-30 Thread Matthew Wilcox
ida_alloc() can return -ENOMEM in the highly unlikely case we run out of memory. The current code creates an object with an invalid ID. Signed-off-by: Matthew Wilcox --- drivers/gpu/drm/virtio/virtgpu_object.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a

Re: [PATCH 0/4] Improve virtio ID allocation

2018-10-30 Thread Matthew Wilcox
On Mon, Oct 29, 2018 at 10:53:39PM +0100, Gerd Hoffmann wrote: > On Wed, Sep 26, 2018 at 09:00:27AM -0700, Matthew Wilcox wrote: > > I noticed you were using IDRs where you could be using the more efficient > > IDAs, then while fixing that I noticed the lack of error handling, >

Re: [PATCH 4/4] drm/virtio: Use IDAs more efficiently

2018-10-02 Thread Matthew Wilcox
On Tue, Oct 02, 2018 at 01:43:28PM +0200, Gerd Hoffmann wrote: > On Wed, Sep 26, 2018 at 09:04:55AM -0700, Matthew Wilcox wrote: > > On Wed, Sep 26, 2018 at 09:00:31AM -0700, Matthew Wilcox wrote: > > > @@ -59,6 +59,7 @@ static int virtio_gpu_context_create(struct > > &g

Re: [PATCH 4/4] drm/virtio: Use IDAs more efficiently

2018-09-26 Thread Matthew Wilcox
On Wed, Sep 26, 2018 at 09:00:31AM -0700, Matthew Wilcox wrote: > @@ -59,6 +59,7 @@ static int virtio_gpu_context_create(struct > virtio_gpu_device *vgdev, > > if (handle < 0) > return handle; > + handle++; > virtio_gpu_cmd_context_create(v

[PATCH 4/4] drm/virtio: Use IDAs more efficiently

2018-09-26 Thread Matthew Wilcox
0-based IDAs are more efficient than any other base. Convert the 1-based IDAs to be 0-based. Signed-off-by: Matthew Wilcox --- drivers/gpu/drm/virtio/virtgpu_kms.c | 3 ++- drivers/gpu/drm/virtio/virtgpu_vq.c | 7 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers

[PATCH 3/4] drm/virtio: Handle object ID allocation errors

2018-09-26 Thread Matthew Wilcox
It is possible to run out of memory while allocating IDs. The current code would create an object with an invalid ID; change it to return -ENOMEM to the caller. Signed-off-by: Matthew Wilcox --- drivers/gpu/drm/virtio/virtgpu_drv.h | 3 +-- drivers/gpu/drm/virtio/virtgpu_fb.c| 10

[PATCH 0/4] Improve virtio ID allocation

2018-09-26 Thread Matthew Wilcox
rly handle one of the error cases ... see the comment embedded in one of the patches. Matthew Wilcox (4): drm/virtio: Replace IDRs with IDAs drm/virtio: Handle context ID allocation errors drm/virtio: Handle object ID allocation errors drm/virtio: Use IDAs more efficiently drivers/gpu/

[PATCH 2/4] drm/virtio: Handle context ID allocation errors

2018-09-26 Thread Matthew Wilcox
It is possible to run out of memory while allocating IDs. The current code would create a context with an invalid ID; change it to return -ENOMEM to userspace. Signed-off-by: Matthew Wilcox --- drivers/gpu/drm/virtio/virtgpu_kms.c | 29 +++- 1 file changed, 11

[PATCH 1/4] drm/virtio: Replace IDRs with IDAs

2018-09-26 Thread Matthew Wilcox
These IDRs were only being used to allocate unique numbers, not to look up pointers, so they can use the more space-efficient IDA instead. Signed-off-by: Matthew Wilcox --- drivers/gpu/drm/virtio/virtgpu_drv.h | 6 ++ drivers/gpu/drm/virtio/virtgpu_kms.c | 18 -- drivers

Re: [PATCH v33 1/4] mm: add a function to get free page blocks

2018-06-15 Thread Matthew Wilcox
On Fri, Jun 15, 2018 at 12:43:10PM +0800, Wei Wang wrote: > +/** > + * get_from_free_page_list - get free page blocks from a free page list > + * @order: the order of the free page list to check > + * @buf: the array to store the physical addresses of the free page blocks > + * @size: the array siz

Re: [PATCH 0/3] Use sbitmap instead of percpu_ida

2018-06-14 Thread Matthew Wilcox
On Thu, Jun 14, 2018 at 10:06:58PM -0400, Martin K. Petersen wrote: > > Matthew, > > > Removing the percpu_ida code nets over 400 lines of removal. It's not > > as spectacular as deleting an entire architecture, but it's still a > > worthy reduction in lines of code. > > Since most of the chang

[PATCH 0/3] Use sbitmap instead of percpu_ida

2018-06-12 Thread Matthew Wilcox
Fixed bugs pointed out by Jens in iscsit_wait_for_tag() - Abstracted out tag freeing as requested by Bart - Made iscsit_wait_for_tag static as pointed out by 0day Matthew Wilcox (3): target: Abstract tag freeing Convert target drivers to use sbitmap Remove percpu_ida drivers/scsi/qla2xxx/ql

[PATCH 3/3] Remove percpu_ida

2018-06-12 Thread Matthew Wilcox
With its one user gone, remove the library code. Signed-off-by: Matthew Wilcox --- include/linux/percpu_ida.h | 83 - lib/Makefile | 2 +- lib/percpu_ida.c | 370 - 3 files changed, 1 insertion(+), 454 deletions(-) delete

[PATCH 2/3] Convert target drivers to use sbitmap

2018-06-12 Thread Matthew Wilcox
better performance justifies the additional complexity. Signed-off-by: Matthew Wilcox Acked-by: Felipe Balbi# f_tcm --- drivers/scsi/qla2xxx/qla_target.c| 10 --- drivers/target/iscsi/iscsi_target_util.c | 33 +--- drivers/target/sbp/sbp_target.c | 5

  1   2   >