Re: [PATCH v3 0/7] Convert skb_frag_t to bio_vec

2019-07-22 Thread Matthew Wilcox
On Fri, Jul 12, 2019 at 11:27:07AM -0700, David Miller wrote: > From: Matthew Wilcox > Date: Fri, 12 Jul 2019 06:43:38 -0700 > > > From: "Matthew Wilcox (Oracle)" > > > > The skb_frag_t and bio_vec are fundamentally the same (page, offset, > > length

[PATCH v3 4/7] net: Reorder the contents of skb_frag_t

2019-07-22 Thread Matthew Wilcox
From: "Matthew Wilcox (Oracle)" Match the layout of bio_vec. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/skbuff.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 7910935410e6..b9dc8b4f24b1 10

[PATCH v3 0/7] Convert skb_frag_t to bio_vec

2019-07-22 Thread Matthew Wilcox
From: "Matthew Wilcox (Oracle)" The skb_frag_t and bio_vec are fundamentally the same (page, offset, length) tuple. This patch series unifies the two, leaving the skb_frag_t typedef in place. This has the immediate advantage that we already have iov_iter support for bvecs and don

[PATCH v3 7/7] net: Convert skb_frag_t to bio_vec

2019-07-22 Thread Matthew Wilcox
From: "Matthew Wilcox (Oracle)" There are a lot of users of frag->page_offset, so use a union to avoid converting those users today. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/bvec.h | 5 - include/linux/skbuff.h | 9 ++--- 2 files changed, 6 insertions(+)

[PATCH v3 2/7] net: Use skb accessors in network core

2019-07-22 Thread Matthew Wilcox
From: "Matthew Wilcox (Oracle)" In preparation for unifying the skb_frag and bio_vec, use the fine accessors which already exist and use skb_frag_t instead of struct skb_frag_struct. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/skbuff.h | 2 +- net/core/skbuff.c

[PATCH v3 6/7] net: Rename skb_frag_t size to bv_len

2019-07-22 Thread Matthew Wilcox
From: "Matthew Wilcox (Oracle)" Improved compatibility with bvec Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/skbuff.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 8076e2ba8349..e8

[PATCH v3 1/7] net: Use skb accessors in network drivers

2019-07-22 Thread Matthew Wilcox
From: "Matthew Wilcox (Oracle)" In preparation for unifying the skb_frag and bio_vec, use the fine accessors which already exist and use skb_frag_t instead of struct skb_frag_struct. Signed-off-by: Matthew Wilcox (Oracle) --- drivers/crypto/chelsio/chtls/chtls_io.c | 6 +++-

[PATCH v3 5/7] net: Rename skb_frag page to bv_page

2019-07-22 Thread Matthew Wilcox
From: "Matthew Wilcox (Oracle)" One step closer to turning the skb_frag_t into a bio_vec. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/skbuff.h | 12 +--- net/core/skbuff.c | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/linu

[PATCH v3 3/7] net: Increase the size of skb_frag_t

2019-07-22 Thread Matthew Wilcox
From: "Matthew Wilcox (Oracle)" To increase commonality between block and net, we are going to replace the skb_frag_t with the bio_vec. This patch increases the size of skb_frag_t on 32-bit machines from 8 bytes to 12 bytes. The size is unchanged on 64-bit machines. Signed-off-b

Re: [PATCH v3 2/7] net: Use skb accessors in network core

2019-07-23 Thread Matthew Wilcox
On Tue, Jul 23, 2019 at 11:56:41AM +0800, Yunsheng Lin wrote: > > diff --git a/net/core/skbuff.c b/net/core/skbuff.c > > index 6f1e31f674a3..e32081709a0d 100644 > > --- a/net/core/skbuff.c > > +++ b/net/core/skbuff.c > > @@ -2975,11 +2975,15 @@ skb_zerocopy(struct sk_buff *to, struct sk_buff > > *

Re: [net-next:master 13/14] drivers/net/ethernet/faraday/ftgmac100.c:777:13: error: 'skb_frag_t {aka struct bio_vec}' has no member named 'size'

2019-07-23 Thread Matthew Wilcox
On Tue, Jul 23, 2019 at 08:58:44AM +, René van Dorst wrote: > Hi Matthew, > > I see the same issue for the mediatek/mtk_eth_soc driver. Thanks, Rene. The root problem for both of these drivers is that neither are built on x86 with CONFIG_COMPILE_TEST. Is it possible to fix this? An unteste

Re: [PATCH v3 4/7] net: Reorder the contents of skb_frag_t

2019-07-23 Thread Matthew Wilcox
On Tue, Jul 23, 2019 at 10:29:06PM +, Saeed Mahameed wrote: > On Fri, 2019-07-12 at 06:43 -0700, Matthew Wilcox wrote: > > From: "Matthew Wilcox (Oracle)" > > > > Match the layout of bio_vec. > > > > Signed-off-by: Matthew Wilcox (Oracle) > &

Re: [PATCH v3 6/7] net: Rename skb_frag_t size to bv_len

2019-07-23 Thread Matthew Wilcox
On Tue, Jul 23, 2019 at 10:33:59PM +, Saeed Mahameed wrote: > > struct skb_frag_struct { > > struct page *bv_page; > > - __u32 size; > > + unsigned int bv_len; > > __u32 page_offset; > > Why do you keep page_offset name and type as is ? it will make the last > patch much cleaner i

[PATCH] Build fixes for skb_frag_size conversion

2019-07-24 Thread Matthew Wilcox
From: "Matthew Wilcox (Oracle)" I missed a few places. One is in some ifdeffed code which will probably never be re-enabled; the others are in drivers which can't currently be compiled on x86. Signed-off-by: Matthew Wilcox (Oracle) --- drivers/atm/he.c

Re: [PATCH v3 6/7] net: Rename skb_frag_t size to bv_len

2019-07-24 Thread Matthew Wilcox
On Wed, Jul 24, 2019 at 10:49:03AM +, David Laight wrote: > This is 'just plain stupid'. > The 'bv_' prefix of the members of 'struct bvec' is there so that 'grep' > (etc) can be used to find the uses of the members. > > In a 'struct skb_frag_struct' a sensible prefix might be 'sf_'. > > OTOH

[PATCH 0/2] Fix Octeon to build on !MIPS

2019-07-26 Thread Matthew Wilcox
From: "Matthew Wilcox (Oracle)" I typo'd the conversion to skb_frag_t in the Octeon driver, but didn't notice because you can only build it on MIPS, and the buildbots seem overloaded right now. So I've constructed some stubs which let me build it on x86. I'm sure

[PATCH 1/2] octeon: Fix typo

2019-07-26 Thread Matthew Wilcox
From: "Matthew Wilcox (Oracle)" Compile fix from skb_frag_t conversion. Signed-off-by: Matthew Wilcox (Oracle) --- drivers/staging/octeon/ethernet-tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeo

[PATCH 2/2] staging/octeon: Allow test build on !MIPS

2019-07-26 Thread Matthew Wilcox
From: "Matthew Wilcox (Oracle)" Add compile test support by moving all includes of files under asm/octeon into octeon-ethernet.h, and if we're not on MIPS, stub out all the calls into the octeon support code in octeon-stubs.h Signed-off-by: Matthew Wilcox (Oracle) --- drivers

Re: [PATCH 2/2] staging/octeon: Allow test build on !MIPS

2019-07-27 Thread Matthew Wilcox
On Sat, Jul 27, 2019 at 12:57:06PM +0200, Greg KH wrote: > No real objection from me, having this driver able to be built on > non-mips systems would be great. > > But wow, that stubs.h file is huge, you really need all of that? > There's no way to include the files from the mips "core" directly >

Re: [PATCH] net: mdio-octeon: Fix build error and Kconfig warning

2019-08-02 Thread Matthew Wilcox
On Fri, Aug 02, 2019 at 06:30:31PM -0700, Nathan Chancellor wrote: > On Fri, Aug 02, 2019 at 06:11:32PM -0700, David Miller wrote: > > The proper way to fix this is to include either > > > > linux/io-64-nonatomic-hi-lo.h > > > > or > > > > linux/io-64-nonatomic-lo-hi.h > > > > whichever

Re: [RFC] MAINTAINERS tag for cleanup robot

2020-11-21 Thread Matthew Wilcox
On Sat, Nov 21, 2020 at 08:50:58AM -0800, t...@redhat.com wrote: > The fixer review is > https://reviews.llvm.org/D91789 > > A run over allyesconfig for x86_64 finds 62 issues, 5 are false positives. > The false positives are caused by macros passed to other macros and by > some macro expansions t

Re: [RFC] MAINTAINERS tag for cleanup robot

2020-11-22 Thread Matthew Wilcox
On Sun, Nov 22, 2020 at 06:46:46AM -0800, Tom Rix wrote: > > On 11/21/20 7:23 PM, Matthew Wilcox wrote: > > On Sat, Nov 21, 2020 at 08:50:58AM -0800, t...@redhat.com wrote: > >> The fixer review is > >> https://reviews.llvm.org/D91789 > >> > >> A

Re: [PATCH] page_frag: Recover from memory pressure

2020-11-09 Thread Matthew Wilcox
On Thu, Nov 05, 2020 at 02:02:24PM +, Matthew Wilcox wrote: > On Thu, Nov 05, 2020 at 02:21:25PM +0100, Eric Dumazet wrote: > > On 11/5/20 5:21 AM, Matthew Wilcox (Oracle) wrote: > > > When the machine is under extreme memory pressure, the page_frag allocator > &g

Re: [PATCH v2 1/1] page_frag: Recover from memory pressure

2020-11-15 Thread Matthew Wilcox
On Sat, Nov 14, 2020 at 10:51:06PM -0800, Dongli Zhang wrote: > + if (nc->pfmemalloc) { You missed the unlikely() change that Eric recommended.

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: [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: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c"

2020-10-22 Thread Matthew Wilcox
On Thu, Oct 22, 2020 at 04:35:17PM +, David Laight wrote: > Wait... > readv(2) defines: > ssize_t readv(int fd, const struct iovec *iov, int iovcnt); It doesn't really matter what the manpage says. What does the AOSP libc header say? > But the syscall is defined as: > > SYSCALL_DEFINE

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: [PATCH 1/1] mm: avoid re-using pfmemalloc page in page_frag_alloc()

2020-11-03 Thread Matthew Wilcox
On Tue, Nov 03, 2020 at 11:32:39AM -0800, Dongli Zhang wrote: > The ethernet driver may allocates skb (and skb->data) via napi_alloc_skb(). > This ends up to page_frag_alloc() to allocate skb->data from > page_frag_cache->va. > > During the memory pressure, page_frag_cache->va may be allocated as

Re: [PATCH 1/1] mm: avoid re-using pfmemalloc page in page_frag_alloc()

2020-11-03 Thread Matthew Wilcox
On Tue, Nov 03, 2020 at 12:57:33PM -0800, Dongli Zhang wrote: > On 11/3/20 12:35 PM, Matthew Wilcox wrote: > > On Tue, Nov 03, 2020 at 11:32:39AM -0800, Dongli Zhang wrote: > >> However, once kernel is not under memory pressure any longer (suppose large > >> amou

Re: [PATCH 1/1] mm: avoid re-using pfmemalloc page in page_frag_alloc()

2020-11-04 Thread Matthew Wilcox
On Wed, Nov 04, 2020 at 09:50:30AM +0100, Eric Dumazet wrote: > On 11/4/20 2:16 AM, Rama Nichanamatlu wrote: > >> Thanks for providing the numbers.  Do you think that dropping (up to) > >> 7 packets is acceptable? > > > > net.ipv4.tcp_syn_retries = 6 > > > > tcp clients wouldn't even get that far

Re: [PATCH] page_frag: Recover from memory pressure

2020-11-05 Thread Matthew Wilcox
On Thu, Nov 05, 2020 at 12:56:43PM +0100, Vlastimil Babka wrote: > > +++ b/mm/page_alloc.c > > @@ -5139,6 +5139,10 @@ void *page_frag_alloc(struct page_frag_cache *nc, > > if (!page_ref_sub_and_test(page, nc->pagecnt_bias)) > > goto refill; > > + if (nc->pf

Re: [PATCH] page_frag: Recover from memory pressure

2020-11-05 Thread Matthew Wilcox
On Thu, Nov 05, 2020 at 02:21:25PM +0100, Eric Dumazet wrote: > On 11/5/20 5:21 AM, Matthew Wilcox (Oracle) wrote: > > When the machine is under extreme memory pressure, the page_frag allocator > > signals this to the networking stack by marking allocations with the > > &#x

Re: [PATCH net-next v3 2/5] mm: add a signature in struct page

2021-04-19 Thread Matthew Wilcox
On Mon, Apr 19, 2021 at 01:22:04PM +0200, Jesper Dangaard Brouer wrote: > On Wed, 14 Apr 2021 13:09:47 -0700 > Shakeel Butt wrote: > > > On Wed, Apr 14, 2021 at 12:42 PM Jesper Dangaard Brouer > > wrote: > > > > > [...] > > > > > > > > > > Can this page_pool be used for TCP RX zerocopy? If yes

Re: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems

2021-04-19 Thread Matthew Wilcox
On Tue, Apr 20, 2021 at 02:48:17AM +, Vineet Gupta wrote: > > 32-bit architectures which expect 8-byte alignment for 8-byte integers > > and need 64-bit DMA addresses (arc, arm, mips, ppc) had their struct > > page inadvertently expanded in 2019. > > FWIW, ARC doesn't require 8 byte alignment

Re: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems

2021-04-20 Thread Matthew Wilcox
On Tue, Apr 20, 2021 at 09:39:54AM +0200, Geert Uytterhoeven wrote: > > +++ b/include/linux/mm_types.h > > @@ -97,10 +97,10 @@ struct page { > > }; > > struct {/* page_pool used by netstack */ > > /** > > -* @dm

Re: [PATCH v2] docs: proc.rst: meminfo: briefly describe gaps in memory accounting

2021-04-20 Thread Matthew Wilcox
On Tue, Apr 20, 2021 at 03:13:54PM +0300, Mike Rapoport wrote: > Add a paragraph that explains that it may happen that the counters in > /proc/meminfo do not add up to the overall memory usage. ... that is, the sum may be lower because memory is allocated for other purposes that is not reported he

Re: [PATCH vhost 3/6] virtio_net: replace private by pp struct inside page

2024-04-18 Thread Matthew Wilcox
On Thu, Apr 18, 2024 at 10:19:33PM +0200, Jesper Dangaard Brouer wrote: > I'm not sure it is "fine" to, explicitly choosing not to use page pool, > and then (ab)use `struct page` member (pp) that intended for page_pool > for other stuff. (In this case create a linked list of pages). > > +#define

Re: [PATCH v2] net:qrtr: fix atomic idr allocation in qrtr_port_assign()

2021-03-27 Thread Matthew Wilcox
On Sat, Mar 27, 2021 at 03:31:18PM +0100, Greg Kroah-Hartman wrote: > On Sat, Mar 27, 2021 at 10:25:20PM +0800, Du Cheng wrote: > > On Sat, Mar 27, 2021 at 03:12:14PM +0100, Greg Kroah-Hartman wrote: > > > Adding the xarray maintainer... > > > > > > On Sat, Mar 27, 2021 at 10:07:02PM +0800, Du Che

Re: [PATCH v2] net:qrtr: fix atomic idr allocation in qrtr_port_assign()

2021-03-28 Thread Matthew Wilcox
On Sun, Mar 28, 2021 at 08:56:17AM +0200, Greg Kroah-Hartman wrote: > On Sat, Mar 27, 2021 at 03:51:10PM +0000, Matthew Wilcox wrote: > > On Sat, Mar 27, 2021 at 03:31:18PM +0100, Greg Kroah-Hartman wrote: > > > On Sat, Mar 27, 2021 at 10:25:20PM +0800, Du Cheng wrote: > >

Re: [PATCH net-next] qrtr: move to staging

2021-03-29 Thread Matthew Wilcox
opers willing to maintain the > > > > > net/qrtr/ code, so move it to drivers/staging/ so that it can be > > > > > removed > > > > > from the kernel tree entirely in a few kernel releases if no one steps > > > > > up to maintain it. > > &g

Something is leaking RCU holds from interrupt context

2021-04-04 Thread Matthew Wilcox
On Sat, Apr 03, 2021 at 09:15:17PM -0700, syzbot wrote: > HEAD commit:2bb25b3a Merge tag 'mips-fixes_5.12_3' of git://git.kernel.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=1284cc31d0 > kernel config: https://syzkaller.appspot.com/x/.config?x=78

Re: Something is leaking RCU holds from interrupt context

2021-04-04 Thread Matthew Wilcox
On Sun, Apr 04, 2021 at 09:48:08AM -0700, Paul E. McKenney wrote: > On Sun, Apr 04, 2021 at 11:24:57AM +0100, Matthew Wilcox wrote: > > On Sat, Apr 03, 2021 at 09:15:17PM -0700, syzbot wrote: > > > HEAD commit:2bb25b3a Merge tag 'mips-fixes_5.12_3' of > > &

Re: Bogus struct page layout on 32-bit

2021-04-10 Thread Matthew Wilcox
How about moving the flags into the union? A bit messy, but we don't have to play games with __packed__. diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 1210a8e41fad..f374d2f06255 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -68,16 +68,22 @@ struc

Re: [PATCH net-next v3 2/5] mm: add a signature in struct page

2021-04-10 Thread Matthew Wilcox
On Sat, Apr 10, 2021 at 12:37:58AM +0200, Matteo Croce wrote: > This is needed by the page_pool to avoid recycling a page not allocated > via page_pool. Is the PageType mechanism more appropriate to your needs? It wouldn't be if you use page->_mapcount (ie mapping it to userspace). > Signed-off-

Re: [PATCH net-next v3 2/5] mm: add a signature in struct page

2021-04-10 Thread Matthew Wilcox
On Sat, Apr 10, 2021 at 09:27:31PM +0300, Ilias Apalodimas wrote: > > Can this page_pool be used for TCP RX zerocopy? If yes then PageType > > can not be used. > > Yes it can, since it's going to be used as your default allocator for > payloads, which might end up on an SKB. > So we have to keep t

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-11 Thread Matthew Wilcox
On Sun, Apr 11, 2021 at 11:43:07AM +0200, Jesper Dangaard Brouer wrote: > On Sat, 10 Apr 2021 21:52:45 +0100 > "Matthew Wilcox (Oracle)" wrote: > > > 32-bit architectures which expect 8-byte alignment for 8-byte integers > > and need 64-bit DMA addresses (arc, a

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-11 Thread Matthew Wilcox
On Sun, Apr 11, 2021 at 11:33:18AM +0100, Matthew Wilcox wrote: > Basically, we have three aligned dwords here. We can either alias with > @flags and the first word of @lru, or the second word of @lru and @mapping, > or @index and @private. @flags is a non-starter. If we use @mappin

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-12 Thread Matthew Wilcox
t; have to be kept intact. In above, I'm unsure @index is untouched. Well, I tried three different approaches. Here's the one I hated the least. From: "Matthew Wilcox (Oracle)" Date: Sat, 10 Apr 2021 16:12:06 -0400 Subject: [PATCH] mm: Fix struct page layout on 32-bit system

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-14 Thread Matthew Wilcox
On Wed, Apr 14, 2021 at 10:10:44AM +0200, Jesper Dangaard Brouer wrote: > Yes, indeed! - And very frustrating. It's keeping me up at night. > I'm dreaming about 32 vs 64 bit data structures. My fitbit stats tell > me that I don't sleep well with these kind of dreams ;-) Then you're going to love

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-14 Thread Matthew Wilcox
On Wed, Apr 14, 2021 at 09:13:22PM +0200, Jesper Dangaard Brouer wrote: > (If others want to reproduce). First I could not reproduce on ARM32. > Then I found out that enabling CONFIG_XEN on ARCH=arm was needed to > cause the issue by enabling CONFIG_ARCH_DMA_ADDR_T_64BIT. hmmm ... you should be a

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-15 Thread Matthew Wilcox
On Thu, Apr 15, 2021 at 08:08:32PM +0200, Jesper Dangaard Brouer wrote: > +static inline > +dma_addr_t page_pool_dma_addr_read(dma_addr_t dma_addr) > +{ > + /* Workaround for storing 64-bit DMA-addr on 32-bit machines in struct > + * page. The page->dma_addr share area with page->compound

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-15 Thread Matthew Wilcox
On Thu, Apr 15, 2021 at 09:11:56PM +, David Laight wrote: > Isn't it possible to move the field down one long? > This might require an explicit zero - but this is not a common > code path - the extra write will be noise. Then it overlaps page->mapping. See emails passim.

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-16 Thread Matthew Wilcox
On Fri, Apr 16, 2021 at 07:32:35AM +, David Laight wrote: > From: Matthew Wilcox > > Sent: 15 April 2021 23:22 > > > > On Thu, Apr 15, 2021 at 09:11:56PM +, David Laight wrote: > > > Isn't it possible to move the field down one long? > > > Th

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-16 Thread Matthew Wilcox
On Thu, Apr 15, 2021 at 08:08:32PM +0200, Jesper Dangaard Brouer wrote: > See below patch. Where I swap32 the dma address to satisfy > page->compound having bit zero cleared. (It is the simplest fix I could > come up with). I think this is slightly simpler, and as a bonus code that assumes the ol

Re: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems

2021-04-16 Thread Matthew Wilcox
Replacement patch to fix compiler warning. From: "Matthew Wilcox (Oracle)" Date: Fri, 16 Apr 2021 16:34:55 -0400 Subject: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems To: bro...@redhat.com Cc: linux-ker...@vger.kernel.org, linux...@kvack.org, netdev@vger.

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-16 Thread Matthew Wilcox
On Fri, Apr 16, 2021 at 07:08:23PM +0200, Jesper Dangaard Brouer wrote: > On Fri, 16 Apr 2021 16:27:55 +0100 > Matthew Wilcox wrote: > > > On Thu, Apr 15, 2021 at 08:08:32PM +0200, Jesper Dangaard Brouer wrote: > > > See below patch. Where I swap32 the dma addre

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-17 Thread Matthew Wilcox
On Sat, Apr 17, 2021 at 12:31:37PM +0200, Arnd Bergmann wrote: > On Fri, Apr 16, 2021 at 5:27 PM Matthew Wilcox wrote: > > diff --git a/include/net/page_pool.h b/include/net/page_pool.h > > index b5b195305346..db7c7020746a 100644 > > --- a/include/net/page_pool.h > > ++

Re: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems

2021-04-17 Thread Matthew Wilcox
On Sat, Apr 17, 2021 at 09:32:06PM +0300, Ilias Apalodimas wrote: > > +static inline void page_pool_set_dma_addr(struct page *page, dma_addr_t > > addr) > > +{ > > + page->dma_addr[0] = addr; > > + if (sizeof(dma_addr_t) > sizeof(unsigned long)) > > + page->dma_addr[1] = addr >> 16 >

Re: [PATCH 2/2] mm: Indicate pfmemalloc pages in compound_head

2021-04-17 Thread Matthew Wilcox
On Sat, Apr 17, 2021 at 09:13:45PM +, David Laight wrote: > > struct {/* page_pool used by netstack */ > > - /** > > -* @dma_addr: might require a 64-bit value on > > -* 32-bit architectures. > > -

Re: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems

2021-04-17 Thread Matthew Wilcox
On Sat, Apr 17, 2021 at 09:18:57PM +, David Laight wrote: > Ugly as well. Thank you for expressing your opinion. Again.

Re: Preemptible idr_alloc() in QRTR code

2021-01-26 Thread Matthew Wilcox
On Tue, Jan 26, 2021 at 10:47:34AM +, Mark Rutland wrote: > Hi, > > When fuzzing arm64 with Syzkaller, I'm seeing some splats where > this_cpu_ptr() is used in the bowels of idr_alloc(), by way of > radix_tree_node_alloc(), in a preemptible context: I sent a patch to fix this last June. The

Re: Preemptible idr_alloc() in QRTR code

2021-01-26 Thread Matthew Wilcox
On Tue, Jan 26, 2021 at 06:36:02PM +, Mark Rutland wrote: > On Tue, Jan 26, 2021 at 11:00:05AM -0600, Bjorn Andersson wrote: > > On Tue 26 Jan 10:21 CST 2021, Mark Rutland wrote: > > > > > On Tue, Jan 26, 2021 at 02:58:33PM +, Matthew Wilcox wrote: > > >

Re: [PATCH] af_unix: Allow Unix sockets to raise SIGURG

2021-01-29 Thread Matthew Wilcox
On Fri, Jan 29, 2021 at 09:56:48AM -0800, Shoaib Rao wrote: > On 1/25/21 3:36 PM, Jakub Kicinski wrote: > > On Fri, 22 Jan 2021 15:06:37 +0000 Matthew Wilcox (Oracle) wrote: > > > From: Rao Shoaib > > > > > > TCP sockets allow SIGURG to be sent to the proces

Re: [PATCH] af_unix: Allow Unix sockets to raise SIGURG

2021-01-29 Thread Matthew Wilcox
On Fri, Jan 29, 2021 at 01:18:20PM -0800, Jakub Kicinski wrote: > On Fri, 29 Jan 2021 12:44:44 -0800 Shoaib Rao wrote: > > On 1/29/21 12:18 PM, Jakub Kicinski wrote: > > > On Fri, 29 Jan 2021 12:10:21 -0800 Shoaib Rao wrote: > > >> The code does not care about the size of data -- All it does is t

Re: [PATCH v3 net-next 1/5] mm: constify page_is_pfmemalloc() argument

2021-01-31 Thread Matthew Wilcox
On Sun, Jan 31, 2021 at 12:11:30PM +, Alexander Lobakin wrote: > The function only tests for page->index, so its argument should be > const. > > Signed-off-by: Alexander Lobakin > Reviewed-by: Jesse Brandeburg > Acked-by: David Rientjes Reviewed-by: Matthew Wilcox (Oracle)

Re: [PATCH v3 net-next 3/5] net: introduce common dev_page_is_reusable()

2021-01-31 Thread Matthew Wilcox
On Sun, Jan 31, 2021 at 12:11:52PM +, Alexander Lobakin wrote: > A bunch of drivers test the page before reusing/recycling for two > common conditions: > - if a page was allocated under memory pressure (pfmemalloc page); > - if a page was allocated at a distant memory node (to exclude >sl

Re: [PATCH v3 net-next 5/5] net: page_pool: simplify page recycling condition tests

2021-01-31 Thread Matthew Wilcox
On Sun, Jan 31, 2021 at 12:12:11PM +, Alexander Lobakin wrote: > pool_page_reusable() is a leftover from pre-NUMA-aware times. For now, > this function is just a redundant wrapper over page_is_pfmemalloc(), > so inline it into its sole call site. Why doesn't this want to use {dev_}page_is_reus

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 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: [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 actua

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 a

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 w

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 misse

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

2021-03-19 Thread Matthew Wilcox
lear 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 net-next] net-sysfs: remove possible sleep from an RCU read-side critical section

2021-03-22 Thread Matthew Wilcox
On Mon, Mar 22, 2021 at 04:43:29PM +0100, Antoine Tenart wrote: > xps_queue_show is mostly made of an RCU read-side critical section and > calls bitmap_zalloc with GFP_KERNEL in the middle of it. That is not > allowed as this call may sleep and such behaviours aren't allowed in RCU > read-side crit

Re: [PATCH net-next] net-sysfs: remove possible sleep from an RCU read-side critical section

2021-03-22 Thread Matthew Wilcox
On Mon, Mar 22, 2021 at 06:41:30PM +0100, Antoine Tenart wrote: > Quoting Matthew Wilcox (2021-03-22 17:54:39) > > - rcu_read_lock(); > > - dev_maps = rcu_dereference(dev->xps_maps[type]); > > + dev_maps = READ_ONCE(dev->xps_maps[type]); > > C

Re: [PATCH 0/3 v5] Introduce a bulk order-0 page allocator

2021-03-23 Thread Matthew Wilcox
On Mon, Mar 22, 2021 at 08:32:54PM +, Chuck Lever III wrote: > > It's not expected that the array implementation would be worse *unless* > > you are passing in arrays with holes in the middle. Otherwise, the success > > rate should be similar. > > Essentially, sunrpc will always pass an array

Re: [PATCH 1/9] mm/page_alloc: Rename alloced to allocated

2021-03-25 Thread Matthew Wilcox
troduced. > > Signed-off-by: Mel Gorman Reviewed-by: Matthew Wilcox (Oracle)

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

2021-03-25 Thread Matthew Wilcox
On Thu, Mar 25, 2021 at 11:42:21AM +, Mel Gorman wrote: > +int __alloc_pages_bulk(gfp_t gfp, int preferred_nid, > + nodemask_t *nodemask, int nr_pages, > + struct list_head *list); > + > +/* Bulk allocate order-0 pages */ > +static inline

Re: [PATCH 4/9] mm/page_alloc: optimize code layout for __alloc_pages_bulk

2021-03-25 Thread Matthew Wilcox
On Thu, Mar 25, 2021 at 11:42:23AM +, Mel Gorman wrote: > > - if (WARN_ON_ONCE(nr_pages <= 0)) > + if (unlikely(nr_pages <= 0)) > return 0; If we made nr_pages unsigned, we wouldn't need this check at all (ok, we'd still need to figure out what to do with 0). But then,

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

2021-03-25 Thread Matthew Wilcox
On Thu, Mar 25, 2021 at 11:42:19AM +, Mel Gorman wrote: > This series introduces a bulk order-0 page allocator with sunrpc and > the network page pool being the first users. The implementation is not > efficient as semantics needed to be ironed out first. If no other semantic > changes are need

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

2021-03-25 Thread Matthew Wilcox
On Thu, Mar 25, 2021 at 03:06:57PM +0100, Uladzislau Rezki wrote: > For the vmalloc we should be able to allocating on a specific NUMA node, > at least the current interface takes it into account. As far as i see > the current interface allocate on a current node: > > static inline unsigned long >

Re: [PATCH] qrtr: Convert qrtr_ports from IDR to XArray

2020-08-13 Thread Matthew Wilcox
On Thu, Aug 13, 2020 at 12:48:10PM +0200, Dmitry Vyukov wrote: > On Fri, Jun 5, 2020 at 6:44 PM Eric Dumazet wrote: > > > > On 6/5/20 5:00 AM, Matthew Wilcox wrote: > > > From: "Matthew Wilcox (Oracle)" > > > > > > The XArray interface is ea

Re: [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM

2018-04-20 Thread Matthew Wilcox
On Thu, Apr 19, 2018 at 12:12:38PM -0400, Mikulas Patocka wrote: > Unfortunatelly, some kernel code has bugs - it uses kvmalloc and then > uses DMA-API on the returned memory or frees it with kfree. Such bugs were > found in the virtio-net driver, dm-integrity or RHEL7 powerpc-specific > code. May

Re: [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM

2018-04-20 Thread Matthew Wilcox
On Fri, Apr 20, 2018 at 03:08:52PM +0200, Michal Hocko wrote: > > In order to detect these bugs reliably I submit this patch that changes > > kvmalloc to always use vmalloc if CONFIG_DEBUG_VM is turned on. > > No way. This is just wrong! First of all, you will explode most likely > on many allocat

Re: [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM

2018-04-20 Thread Matthew Wilcox
On Fri, Apr 20, 2018 at 04:54:53PM -0400, Mikulas Patocka wrote: > On Fri, 20 Apr 2018, Michal Hocko wrote: > > No way. This is just wrong! First of all, you will explode most likely > > on many allocations of small sizes. Second, CONFIG_DEBUG_VM tends to be > > enabled quite often. > > You're an

Re: [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM

2018-04-21 Thread Matthew Wilcox
On Fri, Apr 20, 2018 at 05:21:26PM -0400, Mikulas Patocka wrote: > On Fri, 20 Apr 2018, Matthew Wilcox wrote: > > On Fri, Apr 20, 2018 at 04:54:53PM -0400, Mikulas Patocka wrote: > > > On Fri, 20 Apr 2018, Michal Hocko wrote: > > > > No way. This is just wrong! First

Re: [PATCH v3] kvmalloc: always use vmalloc if CONFIG_DEBUG_SG

2018-04-23 Thread Matthew Wilcox
On Mon, Apr 23, 2018 at 08:06:16PM -0400, Mikulas Patocka wrote: > Some bugs (such as buffer overflows) are better detected > with kmalloc code, so we must test the kmalloc path too. Well now, this brings up another item for the collective TODO list -- implement redzone checks for vmalloc. Unless

Re: [PATCH v3] kvmalloc: always use vmalloc if CONFIG_DEBUG_SG

2018-04-24 Thread Matthew Wilcox
On Tue, Apr 24, 2018 at 08:29:14AM -0400, Mikulas Patocka wrote: > > > On Mon, 23 Apr 2018, Matthew Wilcox wrote: > > > On Mon, Apr 23, 2018 at 08:06:16PM -0400, Mikulas Patocka wrote: > > > Some bugs (such as buffer overflows) are better detected > > > wi

Re: [PATCH net-next 1/2] tcp: add TCP_ZEROCOPY_RECEIVE support for zerocopy receive

2018-04-25 Thread Matthew Wilcox
On Wed, Apr 25, 2018 at 06:01:02AM -0700, Eric Dumazet wrote: > On 04/24/2018 11:28 PM, Christoph Hellwig wrote: > > On Tue, Apr 24, 2018 at 10:27:21PM -0700, Eric Dumazet wrote: > >> When adding tcp mmap() implementation, I forgot that socket lock > >> had to be taken before current->mm->mmap_sem.

Re: [PATCH net-next 1/2] tcp: add TCP_ZEROCOPY_RECEIVE support for zerocopy receive

2018-04-25 Thread Matthew Wilcox
On Wed, Apr 25, 2018 at 09:20:55AM -0700, Eric Dumazet wrote: > On 04/25/2018 09:04 AM, Matthew Wilcox wrote: > > If you don't zap the page range, any of the CPUs in the system where > > any thread in this task have ever run may have a TLB entry pointing to > > this pag

[PATCH v2 0/8] page_frag_cache improvements

2018-03-22 Thread Matthew Wilcox
From: Matthew Wilcox Version 1 was completely wrong-headed and I have repented of the error of my ways. Thanks for educating me. I still think it's possible to improve on the current state of the page_frag allocator, and here are eight patches, each of which I think represents an improv

[PATCH v2 7/8] page_frag: Update documentation

2018-03-22 Thread Matthew Wilcox
From: Matthew Wilcox - Rename Documentation/vm/page_frags to page_frags.rst - Change page_frags.rst to be a user's guide rather than implementation detail. - Add kernel-doc for the page_frag allocator - Move implementation details to the comments in page_alloc.c Signed-off-by: Ma

[PATCH v2 5/8] page_frag_cache: Save memory on small machines

2018-03-22 Thread Matthew Wilcox
From: Matthew Wilcox Only allocate a single page if CONFIG_BASE_SMALL is set. Signed-off-by: Matthew Wilcox --- include/linux/mm_types.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index a63b138ad1a4..0defff9e3c0e 100644 --- a

[PATCH v2 3/8] page_frag_cache: Rename 'nc' to 'pfc'

2018-03-22 Thread Matthew Wilcox
From: Matthew Wilcox This name was a legacy from the 'netdev_alloc_cache' days. Signed-off-by: Matthew Wilcox --- mm/page_alloc.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 6d

[PATCH v2 8/8] page_frag: Account allocations

2018-03-22 Thread Matthew Wilcox
From: Matthew Wilcox Note the number of pages currently used in page_frag allocations. This may help diagnose leaks in page_frag users. Signed-off-by: Matthew Wilcox --- include/linux/mmzone.h | 3 ++- mm/page_alloc.c| 10 +++--- 2 files changed, 9 insertions(+), 4 deletions

[PATCH v2 4/8] page_frag_cache: Rename fragsz to size

2018-03-22 Thread Matthew Wilcox
From: Matthew Wilcox The 'size' variable name used to be used for the page size. Signed-off-by: Matthew Wilcox --- mm/page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c9fc76135dd8..5a2e3e293079 10064

[PATCH v2 1/8] page_frag_cache: Remove pfmemalloc bool

2018-03-22 Thread Matthew Wilcox
From: Matthew Wilcox Save 4/8 bytes by moving the pfmemalloc indicator from its own bool to the top bit of pagecnt_bias. This has no effect on the fastpath of the allocator since the pagecnt_bias cannot go negative. It's a couple of extra instructions in the slowpath. Signed-off-by: Ma

[PATCH v2 6/8] page_frag_cache: Use a mask instead of offset

2018-03-22 Thread Matthew Wilcox
From: Matthew Wilcox By combining 'va' and 'offset' into 'addr' and using a mask instead, we can save a compare-and-branch in the fast-path of the allocator. This removes 4 instructions on x86 (both 32 and 64 bit). We can avoid storing the mask at all if we kno

  1   2   3   4   >