linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: malc <av1474@comtv.ru>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Jianyu Zhan <nasa4836@gmail.com>
Subject: Re: [PATCH] Revert "mm/vmalloc: interchage the implementation of vmalloc_to_{pfn,page}"
Date: Thu, 23 Jan 2014 14:49:54 -0800	[thread overview]
Message-ID: <20140123144954.644c14d60a4b55255d32960b@linux-foundation.org> (raw)
In-Reply-To: <alpine.LNX.2.00.1401232025400.1392@linmac>

On Thu, 23 Jan 2014 20:27:29 +0400 (MSK) malc <av1474@comtv.ru> wrote:

> Sep 17 00:00:00 2001
> From: Vladimir Murzin <murzin.v@gmail.com>
> Date: Thu, 23 Jan 2014 14:54:20 +0400
> Subject: [PATCH] Revert "mm/vmalloc: interchage the implementation of
>  vmalloc_to_{pfn,page}"
> 
> This reverts commit ece86e222db48d04bda218a2be70e384518bb08c.
> 
> Despite being claimed that patch doesn't introduce any functional
> changes in fact it does.
> 
> The "no page" path behaves different now. Originally, vmalloc_to_page
> might return NULL under some conditions, with new implementation it returns
> pfn_to_page(0) which is not the same as NULL.
> 
> Simple test shows the difference.
> 
> test.c
> 
> #include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/vmalloc.h>
> #include <linux/mm.h>
> 
> int __init myi(void)
> {
> 	struct page *p;
> 	void *v;
> 
> 	v = vmalloc(PAGE_SIZE);
> 	/* trigger the "no page" path in vmalloc_to_page*/
> 	vfree(v);
> 
> 	p = vmalloc_to_page(v);
> 
> 	pr_err("expected val = NULL, returned val = %p", p);
> 
> 	return -EBUSY;
> }
> 
> void __exit mye(void)
> {
> 
> }
> module_init(myi)
> module_exit(mye)
> 
> Before interchange:
> expected val = NULL, returned val =   (null)
> 
> After interchange:
> expected val = NULL, returned val = c7ebe000
> 

hm, yes, I suppose that's bad.

Rather than reverting the patch we could fix up vmalloc_to_pfn() and/or
vmalloc_to_page() to handle this situation.  Did you try that?

--
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>

  reply	other threads:[~2014-01-23 22:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-23 16:27 malc
2014-01-23 22:49 ` Andrew Morton [this message]
2014-01-24  6:54   ` Vladimir Murzin

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=20140123144954.644c14d60a4b55255d32960b@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=av1474@comtv.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nasa4836@gmail.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