All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: andy.shevchenko@gmail.com, julia@diku.dk, joe@perches.com,
	mhocko@kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tree wide: Use kvfree() than conditional kfree()/vfree()
Date: Sun, 8 Nov 2015 14:30:44 +0900	[thread overview]
Message-ID: <20151108053044.GA540@swordfish> (raw)
In-Reply-To: <201511081404.HGJ65681.LOSJFOtMFOVHFQ@I-love.SAKURA.ne.jp>

On (11/08/15 14:04), Tetsuo Handa wrote:
[..]
> Also, we might want to add a helper that does vmalloc() when
> kmalloc() failed because locations that do
> 
>   ptr = kmalloc(size, GFP_NOFS);
>   if (!ptr)
>       ptr = vmalloc(size); /* Wrong because GFP_KERNEL is used implicitly */
> 
> are found.


ext4 does something like that.


void *ext4_kvmalloc(size_t size, gfp_t flags)
{
	void *ret;

	ret = kmalloc(size, flags | __GFP_NOWARN);
	if (!ret)
		ret = __vmalloc(size, flags, PAGE_KERNEL);
	return ret;
}

	-ss

WARNING: multiple messages have this Message-ID (diff)
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: andy.shevchenko@gmail.com, julia@diku.dk, joe@perches.com,
	mhocko@kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tree wide: Use kvfree() than conditional kfree()/vfree()
Date: Sun, 8 Nov 2015 14:30:44 +0900	[thread overview]
Message-ID: <20151108053044.GA540@swordfish> (raw)
In-Reply-To: <201511081404.HGJ65681.LOSJFOtMFOVHFQ@I-love.SAKURA.ne.jp>

On (11/08/15 14:04), Tetsuo Handa wrote:
[..]
> Also, we might want to add a helper that does vmalloc() when
> kmalloc() failed because locations that do
> 
>   ptr = kmalloc(size, GFP_NOFS);
>   if (!ptr)
>       ptr = vmalloc(size); /* Wrong because GFP_KERNEL is used implicitly */
> 
> are found.


ext4 does something like that.


void *ext4_kvmalloc(size_t size, gfp_t flags)
{
	void *ret;

	ret = kmalloc(size, flags | __GFP_NOWARN);
	if (!ret)
		ret = __vmalloc(size, flags, PAGE_KERNEL);
	return ret;
}

	-ss

--
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:[~2015-11-08  5:32 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-07 11:44 [PATCH] tree wide: Use kvfree() than conditional kfree()/vfree() Tetsuo Handa
2015-11-07 11:44 ` Tetsuo Handa
2015-11-07 18:12 ` Joe Perches
2015-11-07 18:12   ` Joe Perches
2015-11-07 20:05 ` Andy Shevchenko
2015-11-07 20:05   ` Andy Shevchenko
2015-11-07 20:13   ` Andy Shevchenko
2015-11-07 20:13     ` Andy Shevchenko
2015-11-08  5:04     ` Tetsuo Handa
2015-11-08  5:04       ` Tetsuo Handa
2015-11-08  5:30       ` Sergey Senozhatsky [this message]
2015-11-08  5:30         ` Sergey Senozhatsky
2015-11-08 20:11       ` Andy Shevchenko
2015-11-08 20:11         ` Andy Shevchenko
2015-11-09 10:48 ` Michal Hocko
2015-11-09 10:48   ` Michal Hocko
2015-11-09 11:56 Tetsuo Handa
2015-11-09 11:56 ` Tetsuo Handa
2015-11-09 11:56 ` Tetsuo Handa
2015-11-09 11:56 ` Tetsuo Handa
2015-11-09 12:11 ` Jan Kara
2015-11-09 12:11   ` Jan Kara
2015-11-09 12:11   ` Jan Kara
2015-11-09 16:26   ` David Miller
2015-11-09 16:26     ` David Miller
2015-11-09 16:26     ` David Miller
2015-11-09 16:07 ` Russell King - ARM Linux
2015-11-09 16:07   ` Russell King - ARM Linux
2015-11-09 16:07   ` Russell King - ARM Linux
2015-11-09 16:07   ` Russell King - ARM Linux
2015-11-09 20:41 ` Dilger, Andreas
2015-11-09 20:41   ` Dilger, Andreas
2015-11-09 20:41   ` Dilger, Andreas
2015-11-09 21:48 ` Rafael J. Wysocki
2015-11-09 21:48   ` Rafael J. Wysocki
2015-11-09 21:48   ` Rafael J. Wysocki
2015-11-09 23:25   ` Luck, Tony
2015-11-09 23:25     ` Luck, Tony
2015-11-19  0:23 ` David Rientjes
2015-11-19  0:23   ` David Rientjes
2015-11-19  0:23   ` David Rientjes

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=20151108053044.GA540@swordfish \
    --to=sergey.senozhatsky@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=joe@perches.com \
    --cc=julia@diku.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /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.