linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Hyeonggon Yoo <42.hyeyoo@gmail.com>,
	"Christoph Lameter (Ampere)" <cl@gentwo.org>
Cc: Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	linux-mm@kvack.org
Subject: Re: [RFC PATCH] mm/slab: fix a memory leak on kobject_init_and_add() failure
Date: Wed, 23 Oct 2024 11:28:00 +0200	[thread overview]
Message-ID: <200f4eb7-f367-4020-ad44-382e3a24ee2a@suse.cz> (raw)
In-Reply-To: <CAB=+i9SDAv1cxBysfTia1f5TewiD2rNJQKFAvAcNGwA3Sar38g@mail.gmail.com>

On 10/23/24 11:23, Hyeonggon Yoo wrote:
> On Wed, Oct 23, 2024 at 1:08 AM Christoph Lameter (Ampere)
> <cl@gentwo.org> wrote:
>>
>> On Tue, 22 Oct 2024, Vlastimil Babka wrote:
>>
>> > On 10/21/24 18:27, Christoph Lameter (Ampere) wrote:
>> > > On Mon, 21 Oct 2024, Vlastimil Babka wrote:
>> > >
>> > >> I think the comment "If this function returns an error, kobject_put() must
>> > >> be called" means that *if* you want to destroy it due to the failure, you
>> > >> must use kobject_put() and not e.g. kfree(). But IMHO it doesn't mean you
>> > >> must destroy it because of the kobject_add() failure.
>> > >
>> > > Right. The simplest solution is to see the sysfs stuff as optional. If it
>> >
>> > To clarify, I only meant the case of boot caches processed for sysfs later.
>> > I don't think we need to start ignoring all sysfs errors.
>>
>> Well not ignoring. Write something to the syslog. So it wont affect slab
>> operations. /sys support is not critical to the slab subsystem operations
>> and is often not used at all.
>>
>> If its conks out then it should be fixed but it should not impact current
>> operations. We have had so many issues with sysfs support in the past that
>> doing so would be wise to avoid future problems.
> 
> Both directions look fine to me. Christoph's approach would probably be better
> for maintainability I think? Failing to create sysfs files is not a
> critical problem anyway.

Yeah I guess, if it makes things simpler... Feel free to do that as v2 then!


  reply	other threads:[~2024-10-23  9:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21  9:14 Hyeonggon Yoo
2024-10-21 10:13 ` Vlastimil Babka
2024-10-21 16:27   ` Christoph Lameter (Ampere)
2024-10-22 15:12     ` Vlastimil Babka
2024-10-22 16:08       ` Christoph Lameter (Ampere)
2024-10-23  9:23         ` Hyeonggon Yoo
2024-10-23  9:28           ` Vlastimil Babka [this message]
2024-10-23 17:12             ` Vlastimil Babka

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=200f4eb7-f367-4020-ad44-382e3a24ee2a@suse.cz \
    --to=vbabka@suse.cz \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox