All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: netdev@vger.kernel.org, Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH] mm: Decline to manipulate the refcount on a slab page
Date: Mon, 10 Mar 2025 17:57:51 +0100	[thread overview]
Message-ID: <77fa8d7e-4752-4979-affe-aa45c8d7795a@suse.de> (raw)
In-Reply-To: <20250310142750.1209192-1-willy@infradead.org>

On 3/10/25 15:27, Matthew Wilcox (Oracle) wrote:
> Slab pages now have a refcount of 0, so nobody should be trying to
> manipulate the refcount on them.  Doing so has little effect; the object
> could be freed and reallocated to a different purpose, although the slab
> itself would not be until the refcount was put making it behave rather
> like TYPESAFE_BY_RCU.
> 
> Unfortunately, __iov_iter_get_pages_alloc() does take a refcount.
> Fix that to not change the refcount, and make put_page() silently not
> change the refcount.  get_page() warns so that we can fix any other
> callers that need to be changed.
> 
> Long-term, networking needs to stop taking a refcount on the pages that
> it uses and rely on the caller to hold whatever references are necessary
> to make the memory stable.  In the medium term, more page types are going
> to hav a zero refcount, so we'll want to move get_page() and put_page()
> out of line.
> 
> Reported-by: Hannes Reinecke <hare@suse.de>
> Fixes: 9aec2fb0fd5e (slab: allocate frozen pages)
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>   include/linux/mm.h | 7 ++++++-
>   lib/iov_iter.c     | 8 ++++++--
>   2 files changed, 12 insertions(+), 3 deletions(-)
> 

I assume we will have a discussion at LSF around frozen pages/slab
behaviour?
It's not just networking, also every driver using iov_alloc_pages() and
friends is potentially affected.
And it would be good to clarify rules how these iterators should be
used.

But that doesn't affect this patch, so:

Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich

  reply	other threads:[~2025-03-10 16:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-10 14:27 [PATCH] mm: Decline to manipulate the refcount on a slab page Matthew Wilcox (Oracle)
2025-03-10 16:57 ` Hannes Reinecke [this message]
2025-03-10 18:28   ` Matthew Wilcox
2025-03-11  7:05     ` Hannes Reinecke
  -- strict thread matches above, loose matches on Subject: below --
2025-03-10 14:35 Matthew Wilcox (Oracle)
2025-03-10 14:37 ` Vlastimil Babka
2025-03-10 14:50   ` Matthew Wilcox
2025-03-11 10:15 ` Jakub Kicinski
2025-03-11 15:46   ` Hannes Reinecke
2025-03-11 16:59     ` Matthew Wilcox
2025-03-12  5:48       ` Christoph Hellwig
2025-03-13  7:22         ` Hannes Reinecke
2025-03-13  7:36           ` Christoph Hellwig
2025-03-13  8:34             ` Hannes Reinecke
2025-03-13  8:44               ` Christoph Hellwig
2025-03-13  8:52                 ` Hannes Reinecke
2025-03-13  9:15                   ` Christoph Hellwig
2025-03-12  5:47   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77fa8d7e-4752-4979-affe-aa45c8d7795a@suse.de \
    --to=hare@suse.de \
    --cc=netdev@vger.kernel.org \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.