From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: akpm@linux-foundation.org, toshi.kani@hp.com,
linuxram@us.ibm.com, rientjes@google.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [Bug fix PATCH v4] Reusing a resource structure allocated by bootmem
Date: Fri, 19 Apr 2013 08:21:36 +0900 [thread overview]
Message-ID: <51708000.4060106@jp.fujitsu.com> (raw)
In-Reply-To: <20130418134206.GB21444@cmpxchg.org>
2013/04/18 22:42, Johannes Weiner wrote:
> On Thu, Apr 18, 2013 at 05:36:12PM +0900, Yasuaki Ishimatsu wrote:
>> @@ -151,6 +162,39 @@ __initcall(ioresources_init);
>>
>> #endif /* CONFIG_PROC_FS */
>>
>> +static void free_resource(struct resource *res)
>> +{
>> + if (!res)
>> + return;
>> +
>> + if (PageSlab(virt_to_head_page(res))) {
>> + spin_lock(&bootmem_resource_lock);
>> + res->sibling = bootmem_resource.sibling;
>> + bootmem_resource.sibling = res;
>> + spin_unlock(&bootmem_resource_lock);
>> + } else {
>> + kfree(res);
>> + }
>
> The branch is mixed up, you are collecting slab objects in
> bootmem_resource and kfreeing bootmem.
Ah. I'm wrong. I'll update soon.
Thanks,
Yasuaki Ishimatsu
>
>> +static struct resource *get_resource(gfp_t flags)
>> +{
>> + struct resource *res = NULL;
>> +
>> + spin_lock(&bootmem_resource_lock);
>> + if (bootmem_resource.sibling) {
>> + res = bootmem_resource.sibling;
>> + bootmem_resource.sibling = res->sibling;
>> + memset(res, 0, sizeof(struct resource));
>> + }
>> + spin_unlock(&bootmem_resource_lock);
>> +
>> + if (!res)
>> + res = kzalloc(sizeof(struct resource), flags);
>> +
>> + return res;
>> +}
>> +
>> /* Return the conflict entry if you can't request it */
>> static struct resource * __request_resource(struct resource *root, struct resource *new)
>> {
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: <akpm@linux-foundation.org>, <toshi.kani@hp.com>,
<linuxram@us.ibm.com>, <rientjes@google.com>,
<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>
Subject: Re: [Bug fix PATCH v4] Reusing a resource structure allocated by bootmem
Date: Fri, 19 Apr 2013 08:21:36 +0900 [thread overview]
Message-ID: <51708000.4060106@jp.fujitsu.com> (raw)
In-Reply-To: <20130418134206.GB21444@cmpxchg.org>
2013/04/18 22:42, Johannes Weiner wrote:
> On Thu, Apr 18, 2013 at 05:36:12PM +0900, Yasuaki Ishimatsu wrote:
>> @@ -151,6 +162,39 @@ __initcall(ioresources_init);
>>
>> #endif /* CONFIG_PROC_FS */
>>
>> +static void free_resource(struct resource *res)
>> +{
>> + if (!res)
>> + return;
>> +
>> + if (PageSlab(virt_to_head_page(res))) {
>> + spin_lock(&bootmem_resource_lock);
>> + res->sibling = bootmem_resource.sibling;
>> + bootmem_resource.sibling = res;
>> + spin_unlock(&bootmem_resource_lock);
>> + } else {
>> + kfree(res);
>> + }
>
> The branch is mixed up, you are collecting slab objects in
> bootmem_resource and kfreeing bootmem.
Ah. I'm wrong. I'll update soon.
Thanks,
Yasuaki Ishimatsu
>
>> +static struct resource *get_resource(gfp_t flags)
>> +{
>> + struct resource *res = NULL;
>> +
>> + spin_lock(&bootmem_resource_lock);
>> + if (bootmem_resource.sibling) {
>> + res = bootmem_resource.sibling;
>> + bootmem_resource.sibling = res->sibling;
>> + memset(res, 0, sizeof(struct resource));
>> + }
>> + spin_unlock(&bootmem_resource_lock);
>> +
>> + if (!res)
>> + res = kzalloc(sizeof(struct resource), flags);
>> +
>> + return res;
>> +}
>> +
>> /* Return the conflict entry if you can't request it */
>> static struct resource * __request_resource(struct resource *root, struct resource *new)
>> {
next prev parent reply other threads:[~2013-04-18 23:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-18 8:36 [Bug fix PATCH v4] Reusing a resource structure allocated by bootmem Yasuaki Ishimatsu
2013-04-18 8:36 ` Yasuaki Ishimatsu
2013-04-18 13:42 ` Johannes Weiner
2013-04-18 13:42 ` Johannes Weiner
2013-04-18 23:21 ` Yasuaki Ishimatsu [this message]
2013-04-18 23:21 ` Yasuaki Ishimatsu
2013-04-18 14:23 ` Toshi Kani
2013-04-18 14:23 ` Toshi Kani
2013-04-18 23:33 ` Yasuaki Ishimatsu
2013-04-18 23:33 ` Yasuaki Ishimatsu
2013-04-18 23:28 ` Toshi Kani
2013-04-18 23:28 ` Toshi Kani
2013-04-18 23:43 ` Yasuaki Ishimatsu
2013-04-18 23:43 ` Yasuaki Ishimatsu
2013-04-19 8:09 ` Yasuaki Ishimatsu
2013-04-19 8:09 ` Yasuaki Ishimatsu
2013-04-19 14:30 ` Toshi Kani
2013-04-19 14:30 ` Toshi Kani
2013-04-23 0:19 ` Yasuaki Ishimatsu
2013-04-23 0:19 ` 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=51708000.4060106@jp.fujitsu.com \
--to=isimatu.yasuaki@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxram@us.ibm.com \
--cc=rientjes@google.com \
--cc=toshi.kani@hp.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 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.