linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robin Holt <holt@sgi.com>
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: Robin Holt <holt@sgi.com>, Greg Kroah-Hartmann <greg@kroah.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: question about link_mem_sections()
Date: Mon, 12 Dec 2011 06:45:38 -0600	[thread overview]
Message-ID: <20111212124538.GC2547@sgi.com> (raw)
In-Reply-To: <CAPXgP10gRKAgo1ExkvLyNqceKpGujcov90umPQCRiNJ=qTwU_A@mail.gmail.com>

On Mon, Dec 12, 2011 at 01:35:50PM +0100, Kay Sievers wrote:
> Robin,
> 
> you added find_memory_block_hinted() with:
>   http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=63d027a63888e993545d10fdfe4107d543f01bca
> 
> I try to understand what's going on here, because we need to switch
> away from 'struct sysdev'.
> 
> In the loop over the node data you call find_memory_block_hinted() in
> a row, which might all take a reference. At the end of the section you
> drop only the last reference of the iteration. The code before your
> change dropped all references inside the loop.
> 
> Could you please explain the intended behaviour?
> 
> If all is right, we should at least move the now wrong comment where is belongs.

Take a look at that commit's parent's parent:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=c25d1dfbd403209025df41a737f82ce8f43d93f5

This adds the kset_find_obj_hinted() function.  That function expects
the kobject_get to have already been done on the object passed in and
will release that reference when it advances to the next object.

Within the loop of the link_mem_sections(), we need to retain the
kobject_get reference between calls to find_memory_block_hinted() and
rely upon that functions call to kset_find_obj_hinted() to release all
but the last reference.

I hope that explains things.  If not, please feel free to ping me again.

Thanks,
Robin

  reply	other threads:[~2011-12-12 12:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-12 12:35 question about link_mem_sections() Kay Sievers
2011-12-12 12:45 ` Robin Holt [this message]
2011-12-12 13:11   ` Kay Sievers
2011-12-12 13:49     ` Robin Holt
2011-12-22  1:18       ` Kay Sievers
2011-12-22  9:30         ` Robin Holt

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=20111212124538.GC2547@sgi.com \
    --to=holt@sgi.com \
    --cc=greg@kroah.com \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.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).