From: Dave Hansen <dave@linux.vnet.ibm.com>
To: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: gregkh@suse.de, cascardo@holoscopio.com,
dan.magenheimer@oracle.com, rdunlap@xenotime.net,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
rcj@linux.vnet.ibm.com, brking@linux.vnet.ibm.com,
ngupta@vflare.org
Subject: Re: [PATCH] staging: zcache: fix crash on cpu remove
Date: Thu, 06 Oct 2011 13:17:32 -0700 [thread overview]
Message-ID: <1317932252.15807.69.camel@nimitz> (raw)
In-Reply-To: <1317929306-18471-1-git-send-email-sjenning@linux.vnet.ibm.com>
On Thu, 2011-10-06 at 14:28 -0500, Seth Jennings wrote:
>
> + if (kp->obj) {
> + kmem_cache_free(zcache_obj_cache, kp->obj);
> + kp->obj = NULL;
> + }
> + if (kp->page) {
> + free_page((unsigned long)kp->page);
> + kp->page = NULL;
> + }
Getting back from my preempt tangent... :)
I'm not sure how free_page() can oops. If kp->page is NULL free_pages()
will rescue you:
void free_pages(unsigned long addr, unsigned int order)
{
if (addr != 0) {
VM_BUG_ON(!virt_addr_valid((void *)addr));
__free_pages(virt_to_page((void *)addr), order);
}
}
I *thought* we did some of the same for kmem_cache_free(), but maybe
it's just kmalloc/kfree(). Anyway, it's all good. I don't like relying
on the allocators to be nice when freeing NULL pointers anyway.
Acked-by: Dave Hansen <dave@linux.vnet.ibm.com>
-- Dave
prev parent reply other threads:[~2011-10-06 20:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-06 19:28 [PATCH] staging: zcache: fix crash on cpu remove Seth Jennings
2011-10-06 19:55 ` Dave Hansen
2011-10-06 20:17 ` Dave Hansen [this message]
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=1317932252.15807.69.camel@nimitz \
--to=dave@linux.vnet.ibm.com \
--cc=brking@linux.vnet.ibm.com \
--cc=cascardo@holoscopio.com \
--cc=dan.magenheimer@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=ngupta@vflare.org \
--cc=rcj@linux.vnet.ibm.com \
--cc=rdunlap@xenotime.net \
--cc=sjenning@linux.vnet.ibm.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