Re: [PATCH] module: ban '.', '..' as module names, ban '/' in module names

2024-04-14 Thread Matthew Wilcox
On Sun, Apr 14, 2024 at 10:05:05PM +0300, Alexey Dobriyan wrote: > Any other subsystem should use nice helper function aptly named > > string_is_vfs_ready() > > and apply additional restrictions if necessary. > > /proc/modules hints that newlines should be banned too, > and \x1f, and

Re: [PATCH 7/9] mm: Free up PG_slab

2024-04-01 Thread Matthew Wilcox
On Sun, Mar 31, 2024 at 11:11:10PM +0800, kernel test robot wrote: > kernel test robot noticed "UBSAN:shift-out-of-bounds_in_fs/proc/page.c" on: > > commit: 30e5296811312a13938b83956a55839ac1e3aa40 ("[PATCH 7/9] mm: Free up > PG_slab") Quite right. Spotted another one while I was at it. Not

Re: [PATCH v2] virtiofs: use GFP_NOFS when enqueuing request through kworker

2024-01-05 Thread Matthew Wilcox
On Fri, Jan 05, 2024 at 03:41:48PM -0500, Vivek Goyal wrote: > On Fri, Jan 05, 2024 at 08:21:00PM +0000, Matthew Wilcox wrote: > > On Fri, Jan 05, 2024 at 03:17:19PM -0500, Vivek Goyal wrote: > > > On Fri, Jan 05, 2024 at 06:53:05PM +0800, Hou Tao wrote: >

Re: [PATCH v2] virtiofs: use GFP_NOFS when enqueuing request through kworker

2024-01-05 Thread Matthew Wilcox
On Fri, Jan 05, 2024 at 03:17:19PM -0500, Vivek Goyal wrote: > On Fri, Jan 05, 2024 at 06:53:05PM +0800, Hou Tao wrote: > > From: Hou Tao > > > > When invoking virtio_fs_enqueue_req() through kworker, both the > > allocation of the sg array and the bounce buffer still use GFP_ATOMIC. > >

Re: [PATCH] virtiofs: use GFP_NOFS when enqueuing request through kworker

2024-01-03 Thread Matthew Wilcox
On Thu, Jan 04, 2024 at 09:58:05AM +0800, Hou Tao wrote: > static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq, > - struct fuse_req *req, bool in_flight); > + struct fuse_req *req, bool in_flight, > +

Re: [2/2] virtiofs: Improve error handling in virtio_fs_get_tree()

2024-01-02 Thread Matthew Wilcox
On Tue, Jan 02, 2024 at 11:47:38AM +0100, Markus Elfring wrote: > > Do you consider more clarity in your argumentation? > > It is probably clear that the function call “kfree(NULL)” does not perform > data processing which is really useful for the caller. > Such a call is kept in some cases

Re: [2/2] virtiofs: Improve error handling in virtio_fs_get_tree()

2024-01-02 Thread Matthew Wilcox
On Tue, Jan 02, 2024 at 10:35:17AM +0100, Markus Elfring wrote: > >>> So what? kfree(NULL) is perfectly acceptable. > >> > >> I suggest to reconsider the usefulness of such a special function call. > > > > Can you be more explicit in your suggestion? > > I hope that the change acceptance can

Re: [PATCH 2/2] virtiofs: Improve error handling in virtio_fs_get_tree()

2023-12-29 Thread Matthew Wilcox
On Fri, Dec 29, 2023 at 10:10:08AM +0100, Markus Elfring wrote: > >> The kfree() function was called in two cases by > >> the virtio_fs_get_tree() function during error handling > >> even if the passed variable contained a null pointer. > > > > So what? kfree(NULL) is perfectly acceptable. > > I

Re: [PATCH 2/2] virtiofs: Improve error handling in virtio_fs_get_tree()

2023-12-29 Thread Matthew Wilcox
On Fri, Dec 29, 2023 at 09:38:47AM +0100, Markus Elfring wrote: > From: Markus Elfring > Date: Fri, 29 Dec 2023 09:15:07 +0100 > > The kfree() function was called in two cases by > the virtio_fs_get_tree() function during error handling > even if the passed variable contained a null pointer. So

Re: [PATCH v6 2/4] dax/bus: Use guard(device) in sysfs attribute helpers

2023-12-14 Thread Matthew Wilcox
On Thu, Dec 14, 2023 at 10:25:27PM -0700, Vishal Verma wrote: > @@ -294,13 +294,10 @@ static ssize_t available_size_show(struct device *dev, > struct device_attribute *attr, char *buf) > { > struct dax_region *dax_region = dev_get_drvdata(dev); > - unsigned long long size;

Re: [v5 0/1] dax: enable dax fault handler to report VM_FAULT_HWPOISON

2023-06-27 Thread Matthew Wilcox
On Tue, Jun 27, 2023 at 06:22:47PM +0200, Markus Elfring wrote: > >> How do you think about to put additional information below triple dashes > >> (or even into improved change descriptions)? > >> > >> See also: > >>

Re: [v5 0/1] dax: enable dax fault handler to report VM_FAULT_HWPOISON

2023-06-27 Thread Matthew Wilcox
On Tue, Jun 27, 2023 at 08:08:19AM +0200, Markus Elfring wrote: > > The thought was to put descriptions unsuitable for commit header in the > > cover letter. > > How do you think about to put additional information below triple dashes > (or even into improved change descriptions)? > > See also:

Re: [PATCH v2] dax: enable dax fault handler to report VM_FAULT_HWPOISON

2023-04-27 Thread Matthew Wilcox
On Thu, Apr 27, 2023 at 06:35:57PM -0700, Dan Williams wrote: > Jane Chu wrote: > > Hi, Dan, > > > > On 4/27/2023 2:36 PM, Dan Williams wrote: > > > Jane Chu wrote: > > >> When dax fault handler fails to provision the fault page due to > > >> hwpoison, it returns VM_FAULT_SIGBUS which lead to a

Re: [PATCH v2] dax: enable dax fault handler to report VM_FAULT_HWPOISON

2023-04-27 Thread Matthew Wilcox
On Thu, Apr 27, 2023 at 04:36:58PM -0700, Jane Chu wrote: > > This change results in EHWPOISON leaking to usersapce in the case of > > read(2), that's not a return code that block I/O applications have ever > > had to contend with before. Just as badblocks cause EIO to be returned, > > so should

Re: [PATCH] dax: enable dax fault handler to report VM_FAULT_HWPOISON

2023-04-06 Thread Matthew Wilcox
On Thu, Apr 06, 2023 at 11:55:56AM -0600, Jane Chu wrote: > static vm_fault_t dax_fault_return(int error) > { > if (error == 0) > return VM_FAULT_NOPAGE; > - return vmf_error(error); > + else if (error == -ENOMEM) > + return VM_FAULT_OOM; > + else if

Re: [PATCH v9 3/3] mm, pmem, xfs: Introduce MF_MEM_REMOVE for unbind

2023-02-05 Thread Matthew Wilcox
On Sat, Feb 04, 2023 at 02:58:38PM +, Shiyang Ruan wrote: > + if (mf_flags & MF_MEM_PRE_REMOVE) { > + xfs_info(mp, "device is about to be removed!"); > + down_write(>m_super->s_umount); > + error = sync_filesystem(mp->m_super); > + /*

Re: [PATCH v9 1/3] xfs: fix the calculation of length and end

2023-02-05 Thread Matthew Wilcox
On Sat, Feb 04, 2023 at 02:58:36PM +, Shiyang Ruan wrote: > @@ -222,8 +222,8 @@ xfs_dax_notify_failure( > len -= ddev_start - offset; > offset = 0; > } > - if (offset + len > ddev_end) > - len -= ddev_end - offset; > + if (offset + len - 1

Re: [PATCH v9 2/3] fs: move drop_pagecache_sb() for others to use

2023-02-05 Thread Matthew Wilcox
On Sat, Feb 04, 2023 at 02:58:37PM +, Shiyang Ruan wrote: > @@ -678,6 +679,48 @@ void drop_super_exclusive(struct super_block *sb) > } > EXPORT_SYMBOL(drop_super_exclusive); > > +/* You've gone to the trouble of writing kernel-doc, just add the extra '*' and make it actually part of the

[PATCH v5 24/32] tools/testing/nvdimm: Convert to printbuf

2022-08-07 Thread Matthew Wilcox (Oracle)
From: Kent Overstreet This converts from seq_buf to printbuf. Here we're using printbuf with an external buffer, meaning it's a direct conversion. Signed-off-by: Kent Overstreet Cc: Dan Williams Cc: Dave Hansen Cc: nvd...@lists.linux.dev --- tools/testing/nvdimm/test/ndtest.c | 22

Re: [PATCH v2] mm: fix missing wake-up event for FSDAX pages

2022-07-05 Thread Matthew Wilcox
On Tue, Jul 05, 2022 at 02:18:19PM -0700, Andrew Morton wrote: > On Tue, 5 Jul 2022 20:35:32 +0800 Muchun Song > wrote: > > > FSDAX page refcounts are 1-based, rather than 0-based: if refcount is > > 1, then the page is freed. The FSDAX pages can be pinned through GUP, > > then they will be

Re: [PATCH] mm: fix missing wake-up event for FSDAX pages

2022-07-04 Thread Matthew Wilcox
On Mon, Jul 04, 2022 at 03:40:54PM +0800, Muchun Song wrote: > FSDAX page refcounts are 1-based, rather than 0-based: if refcount is > 1, then the page is freed. The FSDAX pages can be pinned through GUP, > then they will be unpinned via unpin_user_page() using a folio variant > to put the page,

Re: [PATCH] sparse: use force attribute for vm_fault_t casts

2022-05-14 Thread Matthew Wilcox
On Sat, May 14, 2022 at 05:26:21PM +0300, Vasily Averin wrote: > Fixes sparse warnings: > ./include/trace/events/fs_dax.h:10:1: sparse: > got restricted vm_fault_t > ./include/trace/events/fs_dax.h:153:1: sparse: > got restricted vm_fault_t > fs/dax.c:563:39: sparse:got restricted

Re: [PATCH v2 3/6] mm: page_vma_mapped: support checking if a pfn is mapped into a vma

2022-02-02 Thread Matthew Wilcox
On Wed, Feb 02, 2022 at 10:33:04PM +0800, Muchun Song wrote: > page_vma_mapped_walk() is supposed to check if a page is mapped into a vma. > However, not all page frames (e.g. PFN_DEV) have a associated struct page > with it. There is going to be some duplicate codes similar with this function >

Re: [PATCH v10 2/9] mm: factor helpers for memory_failure_dev_pagemap

2022-02-01 Thread Matthew Wilcox
On Thu, Jan 27, 2022 at 08:40:51PM +0800, Shiyang Ruan wrote: > +static int mf_generic_kill_procs(unsigned long long pfn, int flags, > + struct dev_pagemap *pgmap) > +{ > + struct page *page = pfn_to_page(pfn); > + LIST_HEAD(to_kill); > + dax_entry_t cookie; > + > + /*

[PATCH] arm64: Show three registers per line

2021-04-20 Thread Matthew Wilcox (Oracle)
Displaying two registers per line takes 15 lines. That improves to just 10 lines if we display three registers per line, which reduces the amount of information lost when oopses are cut off. It stays within 80 columns and matches x86-64. Signed-off-by: Matthew Wilcox (Oracle) --- arch/arm64

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

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 */ > > /** > > -*

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 04/13] Kbuild: Rust support

2021-04-19 Thread Matthew Wilcox
On Mon, Apr 19, 2021 at 09:58:51PM +0200, David Sterba wrote: > On Fri, Apr 16, 2021 at 07:34:51PM +0200, Miguel Ojeda wrote: > > something like: > > > > [0.903456] rust_begin_unwind+0x9/0x10 > > [0.903456] ? _RNvNtCsbDqzXfLQacH_4core9panicking9panic_fmt+0x29/0x30 > > [0.903456] ?

Re: [PATCH v7 09/28] mm: Create FolioFlags

2021-04-19 Thread Matthew Wilcox
On Mon, Apr 19, 2021 at 03:25:46PM +0200, Peter Zijlstra wrote: > On Fri, Apr 09, 2021 at 07:50:46PM +0100, Matthew Wilcox (Oracle) wrote: > > These new functions are the folio analogues of the PageFlags functions. > > If CONFIG_DEBUG_VM_PGFLAGS is enabled, we check the foli

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

Re: [PATCH] secretmem: optimize page_is_secretmem()

2021-04-19 Thread Matthew Wilcox
On Mon, Apr 19, 2021 at 02:56:17PM +0300, Mike Rapoport wrote: > On Mon, Apr 19, 2021 at 12:23:02PM +0100, Matthew Wilcox wrote: > > So you're calling page_is_secretmem() on a struct page without having > > a refcount on it. That is definitely not allowed. secretmem seems

Re: [PATCH] secretmem: optimize page_is_secretmem()

2021-04-19 Thread Matthew Wilcox
On Mon, Apr 19, 2021 at 12:36:19PM +0300, Mike Rapoport wrote: > Well, most if the -4.2% of the performance regression kbuild reported were > due to repeated compount_head(page) in page_mapping(). So the whole point > of this patch is to avoid calling page_mapping(). It's quite ludicrous how many

Re: [PATCH] secretmem: optimize page_is_secretmem()

2021-04-19 Thread Matthew Wilcox
On Mon, Apr 19, 2021 at 11:42:18AM +0300, Mike Rapoport wrote: > The perf profile of the test indicated that the regression is caused by > page_is_secretmem() called from gup_pte_range() (inlined by gup_pgd_range): Uhh ... you're calling it in the wrong place!

Re: [PATCH v2 01/12] docs: path-lookup: update follow_managed() part

2021-04-18 Thread Matthew Wilcox
On Mon, Apr 19, 2021 at 10:33:00AM +0800, Fox Chen wrote: > On Mon, Apr 19, 2021 at 10:17 AM Matthew Wilcox wrote: > > > > On Tue, Mar 16, 2021 at 01:47:16PM +0800, Fox Chen wrote: > > > -In the absence of symbolic links, ``walk_component()`` creates a new

Re: [PATCH v2 01/12] docs: path-lookup: update follow_managed() part

2021-04-18 Thread Matthew Wilcox
On Tue, Mar 16, 2021 at 01:47:16PM +0800, Fox Chen wrote: > -In the absence of symbolic links, ``walk_component()`` creates a new > +As the last step of ``walk_component()``, ``step_into()`` will be called > either You can drop ``..`` from around function named which are followed with ().

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: [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: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 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/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/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-kernel@vger.kernel.org, linux...@kvack.org, net...@vger.

[PATCH 6/6] mm: Constify page_count and page_ref_count

2021-04-16 Thread Matthew Wilcox (Oracle)
Now that compound_head() accepts a const struct page pointer, these two functions can be marked as not modifying the page pointer they are passed. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/page_ref.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include

[PATCH 5/6] mm: Constify get_pfnblock_flags_mask and get_pfnblock_migratetype

2021-04-16 Thread Matthew Wilcox (Oracle)
The struct page is not modified by these routines, so it can be marked const. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pageblock-flags.h | 2 +- mm/page_alloc.c | 13 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/linux

[PATCH 4/6] mm: Make compound_head const-preserving

2021-04-16 Thread Matthew Wilcox (Oracle)
ned-off-by: Matthew Wilcox (Oracle) --- include/linux/page-flags.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 04a34c08e0a6..d8e26243db25 100644 --- a/include/linux/page-flags.h +++ b/include/linux/p

[PATCH 3/6] mm/page_owner: Constify dump_page_owner

2021-04-16 Thread Matthew Wilcox (Oracle)
dump_page_owner() only uses struct page to find the page_ext, and lookup_page_ext() already takes a const argument. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/page_owner.h | 6 +++--- mm/page_owner.c| 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git

[PATCH 2/6] mm/debug: Factor PagePoisoned out of __dump_page

2021-04-16 Thread Matthew Wilcox (Oracle)
Move the PagePoisoned test into dump_page(). Skip the hex print for poisoned pages -- we know they're full of . Move the reason printing from __dump_page() to dump_page(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/debug.c | 25 +++-- 1 file changed, 7

[PATCH 1/6] mm: Make __dump_page static

2021-04-16 Thread Matthew Wilcox (Oracle)
The only caller of __dump_page() now opencodes dump_page(), so remove it as an externally visible symbol. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mmdebug.h | 3 +-- mm/debug.c | 2 +- mm/page_alloc.c | 3 +-- 3 files changed, 3 insertions(+), 5 deletions

[RESEND][PATCH 0/6] Constify struct page arguments

2021-04-16 Thread Matthew Wilcox (Oracle)
offer these patches as a few steps towards being able to make dump_page() take a const page pointer. Matthew Wilcox (Oracle) (6): mm: Make __dump_page static mm/debug: Factor PagePoisoned out of __dump_page mm/page_owner: Constify dump_page_owner mm: Make compound_head const-preserving mm

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

2021-04-16 Thread Matthew Wilcox (Oracle)
loc(). Since page_pool doesn't want to set its magic value on pages which are pfmemalloc, we can use bit 1 of compound_head to indicate that the page came from the memory reserves. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 12 +++- include/linux/mm_types.h |

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

2021-04-16 Thread Matthew Wilcox (Oracle)
get_user_pages_fast() could dereference a bogus compound_head(). Fixes: c25fff7171be ("mm: add dma_addr_t to struct page") Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm_types.h | 4 ++-- include/net/page_pool.h | 12 +++- net/core/page_pool.c | 12 +++

[PATCH 0/2] Change struct page layout for page_pool

2021-04-16 Thread Matthew Wilcox (Oracle)
functionality. It is much less urgent. I'd really like to see Mel & Michal's thoughts on it. I have only compile-tested these patches. Matthew Wilcox (Oracle) (2): mm: Fix struct page layout on 32-bit systems mm: Indicate pfmemalloc pages in compound_head include/linux/mm.h

Re: [PATCH 00/13] [RFC] Rust support

2021-04-16 Thread Matthew Wilcox
On Fri, Apr 16, 2021 at 07:18:48PM +0200, Peter Zijlstra wrote: > On Fri, Apr 16, 2021 at 07:10:17PM +0200, Miguel Ojeda wrote: > > > Of course, UB is only a subset of errors, but it is a major one, and > > particularly critical for privileged code. > > I've seen relatively few UBSAN warnings

Re: [RFCv2 00/13] TDX and guest memory unmapping

2021-04-16 Thread Matthew Wilcox
On Fri, Apr 16, 2021 at 06:40:53PM +0300, Kirill A. Shutemov wrote: > TDX integrity check failures may lead to system shutdown host kernel must > not allow any writes to TD-private memory. This requirment clashes with > KVM design: KVM expects the guest memory to be mapped into host userspace >

Re: [PATCH v7 02/28] mm: Introduce struct folio

2021-04-16 Thread Matthew Wilcox
On Fri, Apr 09, 2021 at 07:50:39PM +0100, Matthew Wilcox (Oracle) wrote: > A struct folio is a new abstraction to replace the venerable struct page. > A function which takes a struct folio argument declares that it will > operate on the entire (possibly compound) page, not just PAGE_S

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

Re: [PATCH 00/13] [RFC] Rust support

2021-04-16 Thread Matthew Wilcox
On Fri, Apr 16, 2021 at 02:07:49PM +0100, Wedson Almeida Filho wrote: > There is nothing in C forcing developers to actually use DEFINE_MUTEX_GUARD. > So > someone may simply forget (or not know that they need) to lock > current->perf_event_mutex and directly access some field protected by it.

Re: [PATCH] dma-buf: Add DmaBufTotal counter in meminfo

2021-04-16 Thread Matthew Wilcox
On Fri, Apr 16, 2021 at 11:37:19AM +0200, Peter Enderborg wrote: > diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c > index 6fa761c9cc78..3c1a82b51a6f 100644 > --- a/fs/proc/meminfo.c > +++ b/fs/proc/meminfo.c > @@ -16,6 +16,7 @@ > #ifdef CONFIG_CMA > #include > #endif > +#include >

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? > > &

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: [Outreachy kernel] [PATCH v2] staging: media: atomisp: pci: Change line break to avoid an open parenthesis at the end of the line

2021-04-15 Thread Matthew Wilcox
On Thu, Apr 15, 2021 at 08:57:04PM +0100, Matthew Wilcox wrote: > On Thu, Apr 15, 2021 at 10:49:55PM +0300, Sakari Ailus wrote: > > On Thu, Apr 15, 2021 at 06:14:09PM +0100, Matthew Wilcox wrote: > > > On Thu, Apr 15, 2021 at 02:08:19PM -0300, Aline Santana Cordeiro wrote: >

Re: [Outreachy kernel] [PATCH v2] staging: media: atomisp: pci: Change line break to avoid an open parenthesis at the end of the line

2021-04-15 Thread Matthew Wilcox
On Thu, Apr 15, 2021 at 10:49:55PM +0300, Sakari Ailus wrote: > On Thu, Apr 15, 2021 at 06:14:09PM +0100, Matthew Wilcox wrote: > > On Thu, Apr 15, 2021 at 02:08:19PM -0300, Aline Santana Cordeiro wrote: > > > -const struct atomisp_format_bridge *get_atomisp_format_bridge_from_mb

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

Re: [Outreachy kernel] [PATCH v2] staging: media: atomisp: pci: Change line break to avoid an open parenthesis at the end of the line

2021-04-15 Thread Matthew Wilcox
On Thu, Apr 15, 2021 at 02:08:19PM -0300, Aline Santana Cordeiro wrote: > -const struct atomisp_format_bridge *get_atomisp_format_bridge_from_mbus( > -u32 mbus_code); > +const struct atomisp_format_bridge* > +get_atomisp_format_bridge_from_mbus(u32 mbus_code); No, this does not match coding

Re: [PATCH v3 0/5] mm/memcg: Reduce kmemcache memory accounting overhead

2021-04-15 Thread Matthew Wilcox
On Tue, Apr 13, 2021 at 09:20:22PM -0400, Waiman Long wrote: > With memory accounting disable, the run time was 2.848s. With memory > accounting enabled, the run times with the application of various > patches in the patchset were: > > Applied patches Run time Accounting overhead Overhead

Re: [PATCH 5.10 12/25] radix tree test suite: Fix compilation

2021-04-15 Thread Matthew Wilcox
On Thu, Apr 15, 2021 at 04:48:06PM +0200, Greg Kroah-Hartman wrote: > From: Matthew Wilcox (Oracle) > > [ Upstream commit 7487de534dcbe143e6f41da751dd3ffcf93b00ee ] > > Commit 4bba4c4bb09a added tools/include/linux/compiler_types.h which > includes linux/compiler-gcc.h. Unf

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

Re: [PATCH 00/13] [RFC] Rust support

2021-04-14 Thread Matthew Wilcox
On Wed, Apr 14, 2021 at 08:45:51PM +0200, oj...@kernel.org wrote: > - Manish Goregaokar implemented the fallible `Box`, `Arc`, and `Rc` > allocator APIs in Rust's `alloc` standard library for us. There's a philosophical point to be discussed here which you're skating right over! Should

Re: [PATCH 09/13] Samples: Rust examples

2021-04-14 Thread Matthew Wilcox
On Wed, Apr 14, 2021 at 09:42:26PM +0200, Miguel Ojeda wrote: > On Wed, Apr 14, 2021 at 9:34 PM Linus Torvalds > wrote: > > > > Honestly, I'd like to see a real example. This is fine for testing, > > but I'd like to see something a bit more real, and a bit less special > > than the Android

Re: [PATCH 01/13] kallsyms: Support "big" kernel symbols (2-byte lengths)

2021-04-14 Thread Matthew Wilcox
On Wed, Apr 14, 2021 at 08:45:52PM +0200, oj...@kernel.org wrote: > Increasing to 255 is not enough in some cases, and therefore > we need to introduce 2-byte lengths to the symbol table. We call > these "big" symbols. > > In order to avoid increasing all lengths to 2 bytes (since most > of them

Re: [PATCH] mm: Optimise nth_page for contiguous memmap

2021-04-14 Thread Matthew Wilcox
On Wed, Apr 14, 2021 at 05:24:42PM +0200, David Hildenbrand wrote: > On 13.04.21 21:46, Matthew Wilcox (Oracle) wrote: > > +#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) > > #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) > >

Re: [PATCH v2 10/16] mm: multigenerational lru: mm_struct list

2021-04-14 Thread Matthew Wilcox
On Tue, Apr 13, 2021 at 12:56:27AM -0600, Yu Zhao wrote: > In order to scan page tables, we add an infrastructure to maintain > either a system-wide mm_struct list or per-memcg mm_struct lists. > Multiple threads can concurrently work on the same mm_struct list, and > each of them will be given a

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: [Outreachy kernel] [PATCH] :staging: rtl8723bs: Remove useless led_blink_hdl()

2021-04-13 Thread Matthew Wilcox
On Tue, Apr 13, 2021 at 09:45:03PM +0200, Fabio M. De Francesco wrote: > 1) The driver doesn't call that function from anywhere else than the macro. > 2) You have explained that the macro add its symbol to a slot in an array > that would shift all the subsequent elements down if that macro is not

[PATCH] mm: Optimise nth_page for contiguous memmap

2021-04-13 Thread Matthew Wilcox (Oracle)
add(%rax,%rcx,8),%rbx Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- include/linux/mm.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 25b9041f9925..2327f99b121f 100644 --- a/include/linux/mm.h +++ b/include/l

Re: [PATCH v7] mm: Add set/end/wait functions for PG_private_2

2021-04-13 Thread Matthew Wilcox
On Tue, Apr 13, 2021 at 04:11:41PM +0100, David Howells wrote: > Suggested-by: Linus Torvalds > Signed-off-by: David Howells > Tested-by: Jeff Layton > Tested-by: Dave Wysochanski Reviewed-by: Matthew Wilcox (Oracle)

Re: [PATCH v3 01/18] vfs: add fileattr ops

2021-04-13 Thread Matthew Wilcox
On Thu, Mar 25, 2021 at 08:37:38PM +0100, Miklos Szeredi wrote: > @@ -107,6 +110,8 @@ fiemap: no > update_time: no > atomic_open: shared (exclusive if O_CREAT is set in open flags) > tmpfile: no > +fileattr_get:no or exclusive > +fileattr_set:exclusive >

Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: hal: Remove camelcase

2021-04-12 Thread Matthew Wilcox
On Mon, Apr 12, 2021 at 11:02:58PM +0200, Fabio M. De Francesco wrote: > Removed camelcase in (some) symbols. Further work is needed. What would be more useful for this driver is making it use drivers/net/wireless/realtek/rtlwifi/btcoexist/ which has already graduated out of staging. I haven't

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 systems 32-bit

Re: [PATCH 02/17] locking: Add split_lock

2021-04-12 Thread Matthew Wilcox
On Mon, Apr 12, 2021 at 04:29:28PM +0200, Thomas Gleixner wrote: > On Fri, Apr 09 2021 at 03:51, Matthew Wilcox wrote: > > Bitlocks do not currently participate in lockdep. Conceptually, a > > bit_spinlock is a split lock, eg across each bucket in a hash table. > > The struc

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

Re: Bogus struct page layout on 32-bit

2021-04-11 Thread Matthew Wilcox
On Sat, Apr 10, 2021 at 09:10:47PM +0200, Arnd Bergmann wrote: > On Sat, Apr 10, 2021 at 4:44 AM Matthew Wilcox wrote: > > + dma_addr_t dma_addr __packed; > > }; > > struct {/* slab, slob and slub */ > >

Re: [PATCH v2] mm: eliminate "expecting prototype" kernel-doc warnings

2021-04-11 Thread Matthew Wilcox
uffle_free_memory(). > Prototype was for __shuffle_free_memory() instead > > Signed-off-by: Randy Dunlap > Cc: Andrew Morton > Cc: linux...@kvack.org > Cc: Matthew Wilcox Reviewed-by: Matthew Wilcox (Oracle)

Re: [PATCH] mm: eliminate "expecting prototype" kernel-doc warnings

2021-04-11 Thread Matthew Wilcox
On Sun, Apr 11, 2021 at 10:43:21AM -0700, Randy Dunlap wrote: > +++ linux-next-20210409/mm/mmu_gather.c > @@ -250,7 +250,7 @@ void tlb_flush_mmu(struct mmu_gather *tl > } > > /** > - * tlb_gather_mmu - initialize an mmu_gather structure for page-table > tear-down > + * __tlb_gather_mmu -

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

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

2021-04-10 Thread Matthew Wilcox (Oracle)
this, insert three words of padding and use the same bits as ->index and ->private, neither of which have to be cleared on free. Fixes: c25fff7171be ("mm: add dma_addr_t to struct page") Signed-off-by: Matthew Wilcox (Oracle) --- include/linux

[PATCH 0/1] Fix struct page layout on 32-bit systems

2021-04-10 Thread Matthew Wilcox (Oracle)
I'd really appreciate people testing this, particularly on arm32/mips32/ppc32 systems with a 64-bit dma_addr_t. Matthew Wilcox (Oracle) (1): mm: Fix struct page layout on 32-bit systems include/linux/mm_types.h | 38 ++ 1 file changed, 26 insertions(+), 12

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

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). >

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 @@

Bogus struct page layout on 32-bit

2021-04-09 Thread Matthew Wilcox
On Sat, Apr 10, 2021 at 06:45:35AM +0800, kernel test robot wrote: > >> include/linux/mm_types.h:274:1: error: static_assert failed due to > >> requirement '__builtin_offsetof(struct page, lru) == > >> __builtin_offsetof(struct folio, lru)' "offsetof(struct page, lru) == > >> offsetof(struct

[PATCH v7 28/28] mm/filemap: Convert page wait queues to be folios

2021-04-09 Thread Matthew Wilcox (Oracle)
Reinforce that if we're waiting for a bit in a struct page, that's actually in the head page by changing the type from page to folio. Increases the size of cachefiles by two bytes, but the kernel core is unchanged in size. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig

[PATCH v7 27/28] mm/filemap: Convert wake_up_page_bit to wake_up_folio_bit

2021-04-09 Thread Matthew Wilcox (Oracle)
All callers have a folio, so use it directly. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Acked-by: Jeff Layton --- mm/filemap.c | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index

[PATCH v7 26/28] mm/filemap: Convert wait_on_page_bit to wait_on_folio_bit

2021-04-09 Thread Matthew Wilcox (Oracle)
We must always wait on the folio, otherwise we won't be woken up. This commit shrinks the kernel by 691 bytes, mostly due to moving the page waitqueue lookup into wait_on_folio_bit_common(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Acked-by: Jeff Layton

[PATCH v7 25/28] mm/writeback: Add wait_for_stable_folio

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

[PATCH v7 24/28] mm/writeback: Add wait_on_folio_writeback

2021-04-09 Thread Matthew Wilcox (Oracle)
to compound_head() which saves 8 bytes and 15 bytes in the two functions. That is more than offset by adding the wait_on_page_writeback compatibility wrapper for a net increase in text of 15 bytes. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Acked-by: Jeff Layton --- fs/afs/write.c

[PATCH v7 23/28] mm/filemap: Add end_folio_writeback

2021-04-09 Thread Matthew Wilcox (Oracle)
this a net saving of 70 bytes. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Acked-by: Jeff Layton --- include/linux/pagemap.h | 3 ++- mm/filemap.c| 38 +++--- mm/folio-compat.c | 6 ++ 3 files changed, 27 insertions

[PATCH v7 22/28] mm/filemap: Add wait_on_folio_locked

2021-04-09 Thread Matthew Wilcox (Oracle)
Also add wait_on_folio_locked_killable(). Turn wait_on_page_locked() and wait_on_page_locked_killable() into wrappers. This eliminates a call to compound_head() from each call-site, reducing text size by 200 bytes for me. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig

[PATCH v7 21/28] mm/filemap: Add __lock_folio_or_retry

2021-04-09 Thread Matthew Wilcox (Oracle)
-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Acked-by: Jeff Layton --- include/linux/pagemap.h | 9 ++--- mm/filemap.c| 10 -- mm/memory.c | 8 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/linux/pagemap.h b/include

[PATCH v7 20/28] mm/filemap: Add __lock_folio_async

2021-04-09 Thread Matthew Wilcox (Oracle)
to 403 bytes, saving 111 bytes. The text shrinks by 132 bytes in total. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Acked-by: Jeff Layton --- fs/io_uring.c | 2 +- include/linux/pagemap.h | 17 - mm/filemap.c| 31

  1   2   3   4   5   6   7   8   9   10   >