Re: [PATCH] btrfs: use kvzalloc for EXTENT_SAME temporary data

2018-05-11 Thread David Sterba
, > >> > GFP_KERNEL); > >> > - cmp.dst_pages = kcalloc(num_pages, sizeof(struct page *), > >> > GFP_KERNEL); > >> > + cmp.src_pages = kvzalloc(num_pages, sizeof(struct page *), > >> > GFP_KERNEL); > >> >

Re: [PATCH] btrfs: use kvzalloc for EXTENT_SAME temporary data

2018-05-11 Thread Timofey Titovets
cmp.dst_pages = kcalloc(num_pages, sizeof(struct page *), GFP_KERNEL); > > > > + cmp.src_pages = kvzalloc(num_pages, sizeof(struct page *), GFP_KERNEL); > > > > + cmp.dst_pages = kvzalloc(num_pages, sizeof(struct page *), GFP_KERNEL); > > > > &g

Re: [PATCH] btrfs: use kvzalloc for EXTENT_SAME temporary data

2018-05-11 Thread Omar Sandoval
s, sizeof(struct page *), > > > GFP_KERNEL); > > > + cmp.dst_pages = kvzalloc(num_pages, sizeof(struct page *), > > > GFP_KERNEL); > > > > Kvzalloc should take 2 parameters and not 3. > > And the right function is kvmalloc_array. > > >

Re: [PATCH] btrfs: use kvzalloc for EXTENT_SAME temporary data

2018-05-11 Thread Filipe Manana
t page *), >> > GFP_KERNEL); >> > + cmp.dst_pages = kvzalloc(num_pages, sizeof(struct page *), >> > GFP_KERNEL); >> >> Kvzalloc should take 2 parameters and not 3. > > And the right function is kvmalloc_array. > >> Also, aren't the corres

Re: [PATCH] btrfs: use kvzalloc for EXTENT_SAME temporary data

2018-05-11 Thread David Sterba
GFP_KERNEL); > > + cmp.src_pages = kvzalloc(num_pages, sizeof(struct page *), > > GFP_KERNEL); > > + cmp.dst_pages = kvzalloc(num_pages, sizeof(struct page *), > > GFP_KERNEL); > > Kvzalloc should take 2 parameters and not 3. And the right function is kvmallo

Re: [PATCH] btrfs: use kvzalloc for EXTENT_SAME temporary data

2018-05-11 Thread Filipe Manana
On Fri, May 11, 2018 at 4:57 PM, David Sterba wrote: > The dedupe range is 16 MiB, with 4KiB pages and 8 byte pointers, the > arrays can be 32KiB large. To avoid allocation failures due to > fragmented memory, use the allocation with fallback to vmalloc. > > Signed-off-by: David

[PATCH] btrfs: use kvzalloc for EXTENT_SAME temporary data

2018-05-11 Thread David Sterba
The dedupe range is 16 MiB, with 4KiB pages and 8 byte pointers, the arrays can be 32KiB large. To avoid allocation failures due to fragmented memory, use the allocation with fallback to vmalloc. Signed-off-by: David Sterba --- This depends on the patches that remove the 16MiB