Re: [PATCH 0/2] swiotlb: rework fix info leak with DMA_FROM_DEVICE

2022-03-04 Thread Matthew Wilcox
On Fri, Mar 04, 2022 at 05:29:08PM +0100, Halil Pasic wrote: > No problem, I can do that. It isn't hard to squash things together, but > when I was about to write the commit message, I had the feeling doing > a revert is cleaner. > > Any other opinions? One patch, not two.

Re: [PATCH v2 00/33] Separate struct slab from struct page

2021-12-25 Thread Matthew Wilcox
On Sat, Dec 25, 2021 at 09:16:55AM +, Hyeonggon Yoo wrote: > # mm: Convert struct page to struct slab in functions used by other subsystems > I'm not familiar with kasan, but to ask: > Does kasan_slab_free detect invalid free if someone frees > an object that is not allocated from slab? >

Re: [PATCH v2 00/33] Separate struct slab from struct page

2021-12-19 Thread Matthew Wilcox
On Mon, Dec 20, 2021 at 01:47:54AM +0100, Vlastimil Babka wrote: > > * mm/slub: Convert print_page_info() to print_slab_info() > > Do we really need to explicitly convert slab_folio()'s result to (struct > > folio *)? > > Unfortunately yes, as long as folio_flags() don't take const struct folio

Re: [PATCH v2 29/33] iommu: Use put_pages_list

2021-12-01 Thread Matthew Wilcox
On Wed, Dec 01, 2021 at 07:15:06PM +0100, Vlastimil Babka wrote: > From: "Matthew Wilcox (Oracle)" > > page->freelist is for the use of slab. We already have the ability > to free a list of pages in the core mm, but it requires the use of a > list_head and for the

Re: [RFC] iommu: Use put_pages_list

2021-10-14 Thread Matthew Wilcox
On Thu, Oct 14, 2021 at 05:17:18PM +0100, Robin Murphy wrote: > On 2021-10-14 12:52, John Garry wrote: > > On 14/10/2021 12:20, Matthew Wilcox wrote: > > > I'm going to keep pinging this patch weekly. > > > > > > On Thu, Oct 07, 2021 at 07:17:02PM +0100

Re: [RFC] iommu: Use put_pages_list

2021-10-14 Thread Matthew Wilcox
I'm going to keep pinging this patch weekly. On Thu, Oct 07, 2021 at 07:17:02PM +0100, Matthew Wilcox wrote: > ping? > > On Thu, Sep 30, 2021 at 05:20:42PM +0100, Matthew Wilcox (Oracle) wrote: > > page->freelist is for the use of slab. We already have the ability > >

Re: [RFC] iommu: Use put_pages_list

2021-10-07 Thread Matthew Wilcox
ping? On Thu, Sep 30, 2021 at 05:20:42PM +0100, Matthew Wilcox (Oracle) wrote: > page->freelist is for the use of slab. We already have the ability > to free a list of pages in the core mm, but it requires the use of a > list_head and for the pages to be chained together throu

[RFC] iommu: Use put_pages_list

2021-09-30 Thread Matthew Wilcox (Oracle)
page->freelist is for the use of slab. We already have the ability to free a list of pages in the core mm, but it requires the use of a list_head and for the pages to be chained together through page->lru. Switch the iommu code over to using free_pages_list(). Signed-off-by: Matthew

Re: [RFC PATCH v3 1/2] mempinfd: Add new syscall to provide memory pin

2021-02-10 Thread Matthew Wilcox
On Tue, Feb 09, 2021 at 08:20:18PM +0800, Zhou Wang wrote: > Agree, will add it in next version. No, don't do another version. Jason is right, this approach is wrong. The point of SVA is that it doesn't require the application to do anything special. If jitter from too-frequent page migration

Re: [RFC PATCH v3 1/2] mempinfd: Add new syscall to provide memory pin

2021-02-07 Thread Matthew Wilcox
On Sun, Feb 07, 2021 at 10:24:28PM +, Song Bao Hua (Barry Song) wrote: > > > In high-performance I/O cases, accelerators might want to perform > > > I/O on a memory without IO page faults which can result in dramatically > > > increased latency. Current memory related APIs could not achieve

Re: [RFC PATCH v3 1/2] mempinfd: Add new syscall to provide memory pin

2021-02-07 Thread Matthew Wilcox
On Sun, Feb 07, 2021 at 04:18:03PM +0800, Zhou Wang wrote: > SVA(share virtual address) offers a way for device to share process virtual > address space safely, which makes more convenient for user space device > driver coding. However, IO page faults may happen when doing DMA > operations. As the

Re: a saner API for allocating DMA addressable pages v2

2020-09-14 Thread Matthew Wilcox
On Mon, Sep 14, 2020 at 04:44:16PM +0200, Christoph Hellwig wrote: > I'm still a little unsure about the API naming, as alloc_pages sort of > implies a struct page return value, but we return a kernel virtual > address. Erm ... dma_alloc_pages() returns a struct page, so is this sentence stale?

Re: [PATCH 11/17] sgiseeq: convert to dma_alloc_noncoherent

2020-09-14 Thread Matthew Wilcox
On Mon, Sep 14, 2020 at 04:44:27PM +0200, Christoph Hellwig wrote: > drivers/net/ethernet/i825xx/lasi_82596.c | 25 ++--- > drivers/net/ethernet/i825xx/lib82596.c | 114 ++- > drivers/net/ethernet/i825xx/sni_82596.c | 4 - > drivers/net/ethernet/seeq/sgiseeq.c | 28

Re: [PATCH 07/28] 53c700: improve non-coherent DMA handling

2020-09-01 Thread Matthew Wilcox
On Tue, Sep 01, 2020 at 06:41:12PM +0200, Helge Deller wrote: > > I still have a zoo of machines running for such testing, including a > > 715/64 and two 730. > > I'm going to test this git tree on the 715/64: The 715/64 is a 7100LC machine though. I think you need to boot on the 730 to test the

Re: [PATCH 07/28] 53c700: improve non-coherent DMA handling

2020-09-01 Thread Matthew Wilcox
On Tue, Sep 01, 2020 at 07:52:40AM -0700, James Bottomley wrote: > I think this looks mostly OK, except for one misnamed parameter below. > Unfortunately, the last non-coherent parisc was the 700 series and I no > longer own a box, so I can't test that part of it (I can fire up the > C360 to test

Re: [PATCH 10/28] mm: only allow page table mappings for built-in zsmalloc

2020-04-08 Thread Matthew Wilcox
On Wed, Apr 08, 2020 at 05:12:03PM +0200, Peter Zijlstra wrote: > On Wed, Apr 08, 2020 at 08:01:00AM -0700, Randy Dunlap wrote: > > Hi, > > > > On 4/8/20 4:59 AM, Christoph Hellwig wrote: > > > diff --git a/mm/Kconfig b/mm/Kconfig > > > index 36949a9425b8..614cc786b519 100644 > > > ---

What is the meaning of PASID_MIN?

2019-02-11 Thread Matthew Wilcox
I'm looking at commit 562831747f6299abd481b5b00bd4fa19d5c8a259 which fails to adequately explain why we can't use PASID 0. Commit af39507305fb83a5d3c475c2851f4d59545d8a18 also doesn't explain why PASID 0 is no longer usable for the intel-svm driver. There are a load of simplifications that

Re: [PATCHv2 1/9] mm: Introduce new vm_insert_range and vm_insert_range_buggy API

2019-02-07 Thread Matthew Wilcox
On Thu, Feb 07, 2019 at 09:19:47PM +0530, Souptick Joarder wrote: > Just thought to take opinion for documentation before placing it in v3. > Does it looks fine ? > > +/** > + * __vm_insert_range - insert range of kernel pages into user vma > + * @vma: user vma to map to > + * @pages: pointer to

Re: [PATCH v3 1/9] mm: Introduce new vm_insert_range API

2018-12-07 Thread Matthew Wilcox
On Fri, Dec 07, 2018 at 03:34:56PM +, Robin Murphy wrote: > > +int vm_insert_range(struct vm_area_struct *vma, unsigned long addr, > > + struct page **pages, unsigned long page_count) > > +{ > > + unsigned long uaddr = addr; > > + int ret = 0, i; > > Some of the sites

Re: [PATCH v5 2/3] iommu/io-pgtable-arm-v7s: Request DMA32 memory, and improve debugging

2018-12-07 Thread Matthew Wilcox
On Fri, Dec 07, 2018 at 02:16:19PM +0800, Nicolas Boichat wrote: > +#ifdef CONFIG_ZONE_DMA32 > +#define ARM_V7S_TABLE_GFP_DMA GFP_DMA32 > +#define ARM_V7S_TABLE_SLAB_CACHE SLAB_CACHE_DMA32 This name doesn't make any sense. Why not ARM_V7S_TABLE_SLAB_FLAGS ? > +#else > +#define

Re: [PATCH v4 9/9] dmapool: debug: prevent endless loop in case of corruption

2018-12-04 Thread Matthew Wilcox
On Tue, Dec 04, 2018 at 12:28:54PM -0800, Andrew Morton wrote: > On Tue, 4 Dec 2018 12:18:01 -0800 Matthew Wilcox wrote: > > I only had a review comment on 8/9, which I then withdrew during my review > > of patch 9/9. Unless I missed something during my re-review of my

Re: [PATCH v4 9/9] dmapool: debug: prevent endless loop in case of corruption

2018-12-04 Thread Matthew Wilcox
On Tue, Dec 04, 2018 at 12:14:43PM -0800, Andrew Morton wrote: > On Tue, 4 Dec 2018 11:22:34 -0500 Tony Battersby > wrote: > > > On 11/13/18 1:36 AM, Matthew Wilcox wrote: > > > On Mon, Nov 12, 2018 at 10:46:35AM -0500, Tony Battersby wrote: > > >

Re: [PATCH 6/9] iommu/dma-iommu.c: Convert to use vm_insert_range

2018-11-23 Thread Matthew Wilcox
On Fri, Nov 23, 2018 at 05:23:06PM +, Robin Murphy wrote: > On 15/11/2018 15:49, Souptick Joarder wrote: > > Convert to use vm_insert_range() to map range of kernel > > memory to user vma. > > > > Signed-off-by: Souptick Joarder > > Reviewed-by: Matthew Wi

Re: [PATCH v2 0/3] iommu/io-pgtable-arm-v7s: Use DMA32 zone for page tables

2018-11-22 Thread Matthew Wilcox
On Thu, Nov 22, 2018 at 12:26:02AM -0800, Christoph Hellwig wrote: > On Wed, Nov 21, 2018 at 06:35:58PM -0800, Matthew Wilcox wrote: > > I think you should look at using the page_frag allocator here. You can > > use whatever GFP_DMA flags you like. > > So I actually t

Re: [PATCH v2 0/3] iommu/io-pgtable-arm-v7s: Use DMA32 zone for page tables

2018-11-21 Thread Matthew Wilcox
On Wed, Nov 21, 2018 at 10:26:26PM +, Robin Murphy wrote: > These are IOMMU page tables, rather than CPU ones, so we're already well > outside arch code - indeed the original motivation of io-pgtable was to be > entirely independent of the p*d types and arch-specific MM code (this Armv7 >

Re: [PATCH v2 0/3] iommu/io-pgtable-arm-v7s: Use DMA32 zone for page tables

2018-11-21 Thread Matthew Wilcox
On Wed, Nov 21, 2018 at 06:20:02PM +, Christopher Lameter wrote: > On Sun, 11 Nov 2018, Nicolas Boichat wrote: > > > This is a follow-up to the discussion in [1], to make sure that the page > > tables allocated by iommu/io-pgtable-arm-v7s are contained within 32-bit > > physical address

Re: [PATCH 1/9] mm: Introduce new vm_insert_range API

2018-11-21 Thread Matthew Wilcox
On Wed, Nov 21, 2018 at 04:19:11AM -0700, William Kucharski wrote: > Could you add a line to the description explicitly stating that a failure > to insert any page in the range will fail the entire routine, something > like: > > > * This allows drivers to insert range of kernel pages they've

Re: [PATCH 1/9] mm: Introduce new vm_insert_range API

2018-11-17 Thread Matthew Wilcox
On Sat, Nov 17, 2018 at 12:26:38PM +0530, Souptick Joarder wrote: > On Fri, Nov 16, 2018 at 11:59 PM Mike Rapoport wrote: > > > + * vm_insert_range - insert range of kernel pages into user vma > > > + * @vma: user vma to map to > > > + * @addr: target user address of this page > > > + * @pages:

Re: [PATCH 1/9] mm: Introduce new vm_insert_range API

2018-11-15 Thread Matthew Wilcox
On Fri, Nov 16, 2018 at 11:00:30AM +0530, Souptick Joarder wrote: > On Thu, Nov 15, 2018 at 11:44 PM Randy Dunlap wrote: > > On 11/15/18 7:45 AM, Souptick Joarder wrote: > > What is the opposite of vm_insert_range() or even of vm_insert_page()? > > or is there no need for that? > > There is no

Re: [PATCH v4 0/9] mpt3sas and dmapool scalability

2018-11-12 Thread Matthew Wilcox
On Mon, Nov 12, 2018 at 10:40:57AM -0500, Tony Battersby wrote: > I posted v3 on August 7. Nobody acked or merged the patches, and then > I got too busy with other stuff to repost until now. Thanks for resending. They were in my pile of things to look at, but that's an ever-growing pile. > I

Re: [PATCH v4 9/9] dmapool: debug: prevent endless loop in case of corruption

2018-11-12 Thread Matthew Wilcox
n't normally in the performance path, but might be with the right config options. With that, I withdraw my objection to the previous patch and Acked-by: Matthew Wilcox Andrew, can you funnel these in through your tree? If you'd rather not, I don't mind stuffing them into a git tree and asking Linus to p

Re: [PATCH v4 8/9] dmapool: improve accuracy of debug statistics

2018-11-12 Thread Matthew Wilcox
On Mon, Nov 12, 2018 at 10:45:58AM -0500, Tony Battersby wrote: > +++ linux/mm/dmapool.c2018-08-06 17:52:53.0 -0400 > @@ -61,6 +61,7 @@ struct dma_pool { /* the pool */ > struct device *dev; > unsigned int allocation; > unsigned int boundary; > +

Re: [PATCH v4 7/9] dmapool: cleanup integer types

2018-11-12 Thread Matthew Wilcox
; the blocks in the entire pool. > > Signed-off-by: Tony Battersby Acked-by: Matthew Wilcox ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v4 6/9] dmapool: improve scalability of dma_pool_free

2018-11-12 Thread Matthew Wilcox
> dmapool private data directly in 'struct page', thereby eliminating > 'struct dma_page'. In big O notation, this improves the algorithm from > O(n^2) to O(n) while also reducing memory usage. > > Thanks to Matthew Wilcox for the suggestion to use struct page. > > Signed-

Re: [PATCH v4 5/9] dmapool: rename fields in dma_page

2018-11-12 Thread Matthew Wilcox
On Mon, Nov 12, 2018 at 10:44:02AM -0500, Tony Battersby wrote: > Rename fields in 'struct dma_page' in preparation for moving them into > 'struct page'. No functional changes. > > in_use -> dma_in_use > offset -> dma_free_off > > Signed-off-by: Tony Battersby

Re: [PATCH v4 4/9] dmapool: improve scalability of dma_pool_alloc

2018-11-12 Thread Matthew Wilcox
te > list of pages that have free blocks ready to (re)allocate. In big O > notation, this improves the algorithm from O(n^2) to O(n). > > Signed-off-by: Tony Battersby Acked-by: Matthew Wilcox ___ iommu mailing list iommu@lists.linux

Re: [PATCH v4 3/9] dmapool: cleanup dma_pool_destroy

2018-11-12 Thread Matthew Wilcox
ttersby Acked-by: Matthew Wilcox ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v4 2/9] dmapool: remove checks for dev == NULL

2018-11-12 Thread Matthew Wilcox
l.c for pool->dev == NULL are both insufficient and causing bloat. > Remove them. > > Signed-off-by: Tony Battersby Acked-by: Matthew Wilcox ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v4 1/9] dmapool: fix boundary comparison

2018-11-12 Thread Matthew Wilcox
On Mon, Nov 12, 2018 at 10:41:34AM -0500, Tony Battersby wrote: > Fixes: e34f44b3517f ("pool: Improve memory usage for devices which can't > cross boundaries") > Signed-off-by: Tony Battersby Acked-by: Matthew Wilcox ___ iommu

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Matthew Wilcox
On Fri, Aug 03, 2018 at 02:43:07PM -0400, Tony Battersby wrote: > Out of curiosity, I just tried to create a dmapool with a NULL dev and > it crashed on this: > > static inline int dev_to_node(struct device *dev) > { > return dev->numa_node; > } > > struct dma_pool *dma_pool_create(const

Re: [PATCH v2 6/9] dmapool: improve scalability of dma_pool_free

2018-08-03 Thread Matthew Wilcox
On Fri, Aug 03, 2018 at 04:05:35PM -0400, Tony Battersby wrote: > For v3 of the patchset, I was also considering to add a note to the > kernel-doc comments for dma_pool_create() to use dma_alloc_coherent() > directly instead of a dma pool if the driver intends to allow userspace > to mmap() the

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Matthew Wilcox
On Fri, Aug 03, 2018 at 06:59:20PM +0300, Andy Shevchenko wrote: > >>> I'm pretty sure this was created in an order to avoid bad looking (and > >>> in some cases frightening) "NULL device *" part. > > JFYI: git log --no-merges --grep 'NULL device \*' I think those commits actually argue in

Re: [PATCH v2 8/9] dmapool: reduce footprint in struct page

2018-08-02 Thread Matthew Wilcox
On Thu, Aug 02, 2018 at 04:01:12PM -0400, Tony Battersby wrote: > This is my attempt to shrink 'dma_free_o' and 'dma_in_use' in 'struct > page' (originally 'offset' and 'in_use' in 'struct dma_page') to 16-bit > so that it is unnecessary to use the '_mapcount' field of 'struct > page'. However,

Re: [PATCH v2 5/9] dmapool: rename fields in dma_page

2018-08-02 Thread Matthew Wilcox
On Thu, Aug 02, 2018 at 03:59:15PM -0400, Tony Battersby wrote: > Rename fields in 'struct dma_page' in preparation for moving them into > 'struct page'. No functional changes. > > in_use -> dma_in_use > offset -> dma_free_o I don't like dma_free_o. dma_free_off is OK by me.

Re: [PATCH v2 4/9] dmapool: improve scalability of dma_pool_alloc

2018-08-02 Thread Matthew Wilcox
On Thu, Aug 02, 2018 at 03:58:40PM -0400, Tony Battersby wrote: > @@ -339,11 +360,16 @@ void *dma_pool_alloc(struct dma_pool *po > > spin_lock_irqsave(>lock, flags); > > - list_add(>page_list, >page_list); > + list_add(>dma_list, >page_list[POOL_AVAIL_IDX]); > ready: >

Re: [PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-27 Thread Matthew Wilcox
On Fri, Jul 27, 2018 at 09:23:30AM -0400, Tony Battersby wrote: > On 07/26/2018 08:07 PM, Matthew Wilcox wrote: > > If you're up for more major surgery, then I think we can put all the > > information currently stored in dma_page into struct page. Something > > like this:

Re: [PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-26 Thread Matthew Wilcox
On Thu, Jul 26, 2018 at 04:06:05PM -0400, Tony Battersby wrote: > On 07/26/2018 03:42 PM, Matthew Wilcox wrote: > > On Thu, Jul 26, 2018 at 02:54:56PM -0400, Tony Battersby wrote: > >> dma_pool_free() scales poorly when the pool contains many pages because > >> pool_fin

Re: [PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-26 Thread Matthew Wilcox
On Thu, Jul 26, 2018 at 02:54:56PM -0400, Tony Battersby wrote: > dma_pool_free() scales poorly when the pool contains many pages because > pool_find_page() does a linear scan of all allocated pages. Improve its > scalability by replacing the linear scan with a red-black tree lookup. > In big O

Re: [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD

2018-05-25 Thread Matthew Wilcox
On Thu, May 24, 2018 at 05:29:43PM +0200, Michal Hocko wrote: > > ie if we had more, > > could we solve our pain by making them more generic? > > Well, if you have more you will consume more bits in the struct pages, > right? Not necessarily ... the zone number is stored in the struct page

Re: [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD

2018-05-24 Thread Matthew Wilcox
On Thu, May 24, 2018 at 02:23:23PM +0200, Michal Hocko wrote: > > If we had eight ZONEs, we could offer: > > No, please no more zones. What we have is quite a maint. burden on its > own. Ideally we should only have lowmem, highmem and special/device > zones for directly kernel accessible memory,

Re: [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD

2018-05-23 Thread Matthew Wilcox
On Tue, May 22, 2018 at 08:37:28PM +0200, Michal Hocko wrote: > So why is this any better than the current code. Sure I am not a great > fan of GFP_ZONE_TABLE because of how it is incomprehensible but this > doesn't look too much better, yet we are losing a check for incompatible > gfp flags. The

Re: [RFC PATCH v2 10/12] mm/zsmalloc: update usage of address zone modifiers

2018-05-22 Thread Matthew Wilcox
On Mon, May 21, 2018 at 11:20:31PM +0800, Huaisheng Ye wrote: > @@ -343,7 +343,7 @@ static void destroy_cache(struct zs_pool *pool) > static unsigned long cache_alloc_handle(struct zs_pool *pool, gfp_t gfp) > { > return (unsigned long)kmem_cache_alloc(pool->handle_cachep, > -

Re: [PATCH v6 00/99] XArray version 6

2018-01-18 Thread Matthew Wilcox
On Thu, Jan 18, 2018 at 05:56:12PM +0100, David Sterba wrote: > On Thu, Jan 18, 2018 at 08:48:43AM -0800, Matthew Wilcox wrote: > > Thank you! I shall attempt to debug. Was this with a btrfs root > > filesystem? I'm most suspicious of those patches right now, since they've &g

Re: [PATCH v6 00/99] XArray version 6

2018-01-18 Thread Matthew Wilcox
On Thu, Jan 18, 2018 at 05:07:50PM +0100, David Sterba wrote: > On Wed, Jan 17, 2018 at 12:20:24PM -0800, Matthew Wilcox wrote: > > From: Matthew Wilcox <mawil...@microsoft.com> > > > > This version of the XArray has no known bugs. > > I've booted this pat

[PATCH v6 56/99] lustre: Convert to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- drivers/staging/lustre/lustre/llite/glimpse.c | 12 +--- drivers/staging/lustre/lustre/mdc/mdc_request.c | 16 2 files changed, 13 insertions(+),

[PATCH v6 89/99] btrfs: Convert buffer_radix to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Eliminate the buffer_lock as the internal xa_lock provides all the necessary protection. We can remove the radix_tree_preload calls, but I can't find a good way to use the 'exists' result from xa_cmpxchg(). We could resort to the advanc

[PATCH v6 91/99] btrfs: Convert name_cache to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> This is a very straightforward conversion. The handling of collisions in the namecache could be better handled with an hlist, but that's a patch for another day. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/btrfs

[PATCH v6 57/99] dax: Convert dax_unlock_mapping_entry to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Replace slot_locked() with dax_locked() and inline unlock_slot() into its only caller. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/dax.c | 48 1 file changed, 16 inser

[PATCH v6 55/99] f2fs: Convert to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> This is a straightforward conversion. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/f2fs/data.c | 3 +-- fs/f2fs/dir.c| 5 + fs/f2fs/inline.c | 6 +- fs/f2fs/node.c | 10 ++ 4 files changed,

[PATCH v6 35/99] mm: Convert __do_page_cache_readahead to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> This one is trivial. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- mm/readahead.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/readahead.c b/mm/readahead.c index f64b31b3a84a..66bcaffd47f0 100

[PATCH v6 37/99] mm: Convert huge_memory to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Quite a straightforward conversion. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- mm/huge_memory.c | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_me

[PATCH v6 93/99] f2fs: Convert ino_root to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> I did a fairly major rewrite of __add_ino_entry(); please check carefully. Also, we can remove ino_list unless it's important to write out orphan inodes in the order they were orphaned. It may also make more sense to combine the

[PATCH v6 36/99] mm: Convert page migration to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- mm/migrate.c | 41 - 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 75d19904dd9a..

[PATCH v6 92/99] f2fs: Convert pids radix tree to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> The XArray API works out rather well for this user. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/f2fs/super.c | 2 -- fs/f2fs/trace.c | 60 - fs/f2fs/trace.h | 2

[PATCH v6 94/99] f2fs: Convert extent_tree_root to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Rename it to extent_array and use the xa_lock in place of the extent_tree_lock mutex. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/f2fs/extent_cache.c | 59 +- fs

[PATCH v6 49/99] shmem: Convert shmem_partial_swap_usage to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Simpler code because the xarray takes care of things like the limit and dereferencing the slot. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- mm/shmem.c | 18 +++--- 1 file changed, 3 insertions(+), 15 deleti

[PATCH v6 51/99] btrfs: Convert page cache to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/btrfs/compression.c | 4 +--- fs/btrfs/extent_io.c | 6 ++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compres

[PATCH v6 50/99] shmem: Comment fixups

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Remove the last mentions of radix tree from various comments. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- mm/shmem.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/shmem.c b/mm/s

[PATCH v6 62/99] dax: Convert dax_insert_pfn_mkwrite to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/dax.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index b66b8c896ed8..e6b25ef112f2 100644 --- a/fs/dax.c +++ b/fs/dax.c

[PATCH v6 64/99] dax: Convert grab_mapping_entry to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/dax.c | 98 +--- 1 file changed, 26 insertions(+), 72 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index

[PATCH v6 73/99] xfs: Convert mru cache to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> This eliminates a call to radix_tree_preload(). Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/xfs/xfs_mru_cache.c | 72 +++--- 1 file changed, 33 insertions(+), 39 deletions(-)

[PATCH v6 74/99] usb: Convert xhci-mem to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> The XArray API is a slightly better fit for xhci_insert_segment_mapping() than the radix tree API was. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- drivers/usb/host/xhci-mem.c | 68 +++---

[PATCH v6 63/99] dax: Convert dax_insert_mapping_entry to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/dax.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index e6b25ef112f2..494e8fb7a98f 100644 --- a/fs/dax.c ++

[PATCH v6 71/99] xfs: Convert pag_ici_root to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Rename pag_ici_root to pag_ici_xa and use XArray APIs instead of radix tree APIs. Shorter code, typechecking on tag numbers, better error checking in xfs_reclaim_inode(), and eliminates a call to radix_tree_preload(). Signed-off-by: Matthew

[PATCH v6 53/99] fs: Convert writeback to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> A couple of short loops. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/fs-writeback.c | 25 + 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-write

[PATCH v6 76/99] irqdomain: Convert to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> In a non-critical path, irqdomain wants to know how many entries are stored in the xarray, so add xa_count(). This is a pretty straightforward conversion; mostly just removing now-redundant locking. The only thing of note is just how much s

[PATCH v6 72/99] xfs: Convert xfs dquot to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> This is a pretty straight-forward conversion. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/xfs/xfs_dquot.c | 38 +- fs/xfs/xfs_qm.c| 36 ++-- fs/

[PATCH v6 75/99] md: Convert raid5-cache to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> This is the first user of the radix tree I've converted which was storing numbers rather than pointers. I'm fairly pleased with how well it came out. There's less boiler-plate involved than there was with the radix tree, so that's a win. I

[PATCH v6 77/99] fscache: Convert to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Removes another user of radix_tree_preload(). Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/fscache/cookie.c | 6 +- fs/fscache/internal.h | 2 +- fs/fscache/object.c | 2 +- fs/fscache/page.c

[PATCH v6 20/99] ida: Convert to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Use the xarray infrstructure like we used the radix tree infrastructure. This lets us get rid of idr_get_free() from the radix tree code. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- include/linux/idr.h| 8 +- i

[PATCH v6 88/99] btrfs: Convert reada_tree to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Rename reada_tree to reada_array. Use the xa_lock in reada_array to replace reada_lock. This has to use a nested spinlock as we take the xa_lock of the reada_extents and reada_zones xarrays while holding the reada_lock. Signed-off-by: M

[PATCH v6 24/99] page cache: Add and replace pages using the XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Use the XArray APIs to add and replace pages in the page cache. This removes two uses of the radix tree preload API and is significantly shorter code. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- include/linux/swap.h |

[PATCH v6 38/99] mm: Convert collapse_shmem to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> I found another victim of the radix tree being hard to use. Because there was no call to radix_tree_preload(), khugepaged was allocating radix_tree_nodes using GFP_ATOMIC. I also converted a local_irq_save()/restore() pair to disable()/

[PATCH v6 52/99] fs: Convert buffer to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Mostly comment fixes, but one use of __xa_set_tag. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/buffer.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index

[PATCH v6 39/99] mm: Convert khugepaged_scan_shmem to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Slightly shorter and easier to read code. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- mm/khugepaged.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugep

[PATCH v6 87/99] btrfs: Convert reada_extents to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Straightforward conversion. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/btrfs/reada.c | 32 +--- fs/btrfs/volumes.c | 2 +- fs/btrfs/volumes.h | 2 +- 3 files changed, 19 insertions(+),

[PATCH v6 30/99] mm: Convert page-writeback to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Includes moving mapping_tagged() to fs.h as a static inline, and changing it to return bool. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- include/linux/fs.h | 17 +-- mm/page-writ

[PATCH v6 32/99] mm: Convert truncate to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> This is essentially xa_cmpxchg() with the locking handled above us, and it doesn't have to handle replacing a NULL entry. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- mm/truncate.c | 15 ++- 1 file changed,

[PATCH v6 79/99] blk-cgroup: Convert to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> This call to radix_tree_preload is awkward. At the point of allocation, we're under not only a local lock, but also under the queue lock. So we can't back out, drop the lock and retry the allocation. Replace this preload call with

[PATCH v6 43/99] shmem: Convert find_swap_entry to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> This is a 1:1 conversion. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- mm/shmem.c | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 654f367aca90..

[PATCH v6 31/99] mm: Convert workingset to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> We construct a fake XA_STATE and use it to delete the node with xa_store() rather than adding a special function for this unique use case. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- include/linux/swap.h | 9 -

[PATCH v6 82/99] s390: Convert gmap to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> The three radix trees in gmap are all converted to the XArray. This is another case where the multiple locks held mandates the use of the xa_reserve() API. The gmap_insert_rmap() function is considerably simplified by using the advanc

[PATCH v6 42/99] shmem: Convert shmem_confirm_swap to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> xa_load has its own RCU locking, so we can eliminate it here. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- mm/shmem.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index

[PATCH v6 81/99] i915: Convert handles_vma to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Straightforward conversion. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- drivers/gpu/drm/i915/i915_gem.c | 2 +- drivers/gpu/drm/i915/i915_gem_context.c | 12 +--- drivers/gpu/drm/i915/i915_g

[PATCH v6 78/99] sh: intc: Convert to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> The radix tree was being protected by a raw spinlock. I believe that was not necessary, and the new internal regular spinlock will be adequate for this array. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- drivers/sh

[PATCH v6 80/99] blk-ioc: Convert to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Skip converting the lock to use xa_lock; I think this code can live with the double-locking. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- block/blk-ioc.c | 13 +++-- include/linux/iocontext.h | 6 +++

[PATCH v6 54/99] nilfs2: Convert to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> I'm not 100% convinced that the rewrite of nilfs_copy_back_pages is correct, but it will at least have different bugs from the current version. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/nilfs2/b

[PATCH v6 66/99] page cache: Finish XArray conversion

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> With no more radix tree API users left, we can drop the GFP flags and use xa_init() instead of INIT_RADIX_TREE(). Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/inode.c | 2 +- include/linux/fs.h | 2 +- mm/swap_st

[PATCH v6 33/99] mm: Convert add_to_swap_cache to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Combine __add_to_swap_cache and add_to_swap_cache into one function since there is no more need to preload. Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- mm/swap_state.c | 93 ++--

[PATCH v6 58/99] dax: Convert lock_slot to XArray

2018-01-17 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- fs/dax.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index f3463d93a6ce..8eab0b56f7f9 100644 --- a/fs/dax.c ++

  1   2   >