From: Ram Pai <linuxram@us.ibm.com>
To: Toshi Kani <toshi.kani@hp.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, tmac@hp.com,
isimatu.yasuaki@jp.fujitsu.com, wency@cn.fujitsu.com,
tangchen@cn.fujitsu.com, jiang.liu@huawei.com
Subject: Re: [PATCH 2/3] resource: Add release_mem_region_adjustable()
Date: Thu, 4 Apr 2013 14:48:49 +0800 [thread overview]
Message-ID: <20130404064849.GA5709@ram.oc3035372033.ibm.com> (raw)
In-Reply-To: <1365018905.11159.113.camel@misato.fc.hp.com>
On Wed, Apr 03, 2013 at 01:55:05PM -0600, Toshi Kani wrote:
> On Wed, 2013-04-03 at 13:37 +0800, Ram Pai wrote:
> > On Tue, Apr 02, 2013 at 10:17:29AM -0600, Toshi Kani wrote:
> > > + while ((res = *p)) {
...snip...
> > > + if (res->start > start || res->end < end) {
> >
> > This check looks sub-optimal; possbily wrong, to me. if the res->start
> > is greater than 'start', then obviously its sibling's start will
> > also be greater than 'start'. So it will loop through all the
> > resources unnecesarily.
>
> I think this check is necessary to check if the requested range fits
> into a resource. It needs to check both sides to verify this. I will
> add some comment on this check.
>
> > you might want something like
> >
> > if (start >= res->end) {
>
> I agree that this list is sorted, so we can optimize an error case (i.e.
> no matching entry is found) with an additional check. I will add the
> following check at the beginning of the while loop.
>
> if (res->start >= end)
> break;
>
> I also realized that the function returns 0 when no matching entry is
> found. I will change it to return -EINVAL as well.
ok. this will take care of it.
>
> >
> > > + p = &res->sibling;
> > > + continue;
> > > + }
> > > +
> > > + if (!(res->flags & IORESOURCE_MEM)) {
> > > + ret = -EINVAL;
> > > + break;
> > > + }
> > > +
> > > + if (!(res->flags & IORESOURCE_BUSY)) {
> > > + p = &res->child;
> > > + continue;
> > > + }
> > > +
> > > + if (res->start == start && res->end == end) {
> > > + /* free the whole entry */
> > > + *p = res->sibling;
> > > + kfree(res);
> >
> > This is incomplete. the prev resource's sibling should now point to
> > this resource's sibling. The parent's child has to be updated if
> > this resource is the first child resource. no?
>
> If this resource is the first child, *p is set to &parent->child. So,
> it will update the parents' child.
But if the resource is not the parent's first child? will it update the
previous siblings ->sibling ?
--
Ram Pai
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2013-04-04 6:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-02 16:17 [PATCH 0/3] Support memory hot-delete to boot memory Toshi Kani
2013-04-02 16:17 ` [PATCH 1/3] resource: Add __adjust_resource() for internal use Toshi Kani
2013-04-03 1:11 ` Yasuaki Ishimatsu
2013-04-02 16:17 ` [PATCH 2/3] resource: Add release_mem_region_adjustable() Toshi Kani
2013-04-03 1:26 ` Yasuaki Ishimatsu
2013-04-03 19:46 ` Toshi Kani
2013-04-03 5:37 ` Ram Pai
2013-04-03 19:55 ` Toshi Kani
2013-04-04 6:48 ` Ram Pai [this message]
2013-04-04 14:07 ` Toshi Kani
2013-04-07 4:01 ` Ram Pai
2013-04-08 14:24 ` Toshi Kani
2013-04-03 7:37 ` Gu Zheng
2013-04-03 19:58 ` Toshi Kani
2013-04-02 16:17 ` [PATCH 3/3] mm: Change __remove_pages() to call release_mem_region_adjustable() Toshi Kani
2013-04-03 1:28 ` Yasuaki Ishimatsu
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=20130404064849.GA5709@ram.oc3035372033.ibm.com \
--to=linuxram@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=jiang.liu@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tangchen@cn.fujitsu.com \
--cc=tmac@hp.com \
--cc=toshi.kani@hp.com \
--cc=wency@cn.fujitsu.com \
/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