linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Miroslav Benes <mbenes@suse.cz>
Cc: Petr Mladek <pmladek@suse.com>, Jiri Kosina <jikos@kernel.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Joe Lawrence <joe.lawrence@redhat.com>,
	Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>,
	"Tobin C . Harding" <tobin@kernel.org>,
	live-patching@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] livepatch: Remove custom kobject state handling
Date: Tue, 7 May 2019 15:06:16 +0200	[thread overview]
Message-ID: <20190507130616.GA17386@kroah.com> (raw)
In-Reply-To: <alpine.LSU.2.21.1905071355430.7486@pobox.suse.cz>

On Tue, May 07, 2019 at 02:32:57PM +0200, Miroslav Benes wrote:
> On Fri, 3 May 2019, Petr Mladek wrote:
> 
> > kobject_init() always succeeds and sets the reference count to 1.
> > It allows to always free the structures via kobject_put() and
> > the related release callback.
> > 
> > Note that the custom kobject state handling was used only
> > because we did not know that kobject_put() can and actually
> > should get called even when kobject_init_and_add() fails.
> > 
> > The patch should not change the existing behavior.
> 
> Pity that the changelog does not describe the change from 
> kobject_init_and_add() to two-stage kobject init (separate kobject_init() 
> and kobject_add()).
> 
> Petr changed it, because now each member of new dynamic lists (created in 
> klp_init_patch_early()) is initialized with kobject_init(), so we do not 
> have to worry about calling kobject_put() (this is slightly different from 
> kobj_added).
> 
> It would also be possible to retain kobject_init_and_add() and move it to 
> klp_init_patch_early(), but it would be uglier in my opinion.

kobject_init_and_add() is only there for the "simple" use cases.
There's no problem with doing the two-stage process on your own like
this, that's exactly what it is there for :)

thanks,

greg k-h

  reply	other threads:[~2019-05-07 13:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 13:26 [PATCH 0/2] livepatch: Remove custom kobject state handling and duplicated code Petr Mladek
2019-05-03 13:26 ` [PATCH 1/2] livepatch: Remove custom kobject state handling Petr Mladek
2019-05-03 16:35   ` Kamalesh Babulal
2019-05-07 12:32   ` Miroslav Benes
2019-05-07 13:06     ` Greg Kroah-Hartman [this message]
2019-05-03 13:26 ` [PATCH 2/2] livepatch: Remove duplicated code for early initialization Petr Mladek
2019-05-03 16:35   ` Kamalesh Babulal
2019-05-03 15:39 ` [PATCH 0/2] livepatch: Remove custom kobject state handling and duplicated code Joe Lawrence
2019-05-03 19:16 ` Jiri Kosina

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=20190507130616.GA17386@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=kamalesh@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=pmladek@suse.com \
    --cc=tobin@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).