From: Bob Liu <bob.liu@oracle.com>
To: Heesub Shin <heesub.shin@samsung.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Seth Jennings <sjenning@linux.vnet.ibm.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Dongjun Shin <d.j.shin@samsung.com>,
Sunae Seo <sunae.seo@samsung.com>, Heesub Shin <heesub@gmail.com>
Subject: Re: [PATCH] mm: zbud: fix condition check on allocation size
Date: Thu, 18 Jul 2013 20:48:00 +0800 [thread overview]
Message-ID: <51E7E400.4070705@oracle.com> (raw)
In-Reply-To: <1374071410-9337-1-git-send-email-heesub.shin@samsung.com>
On 07/17/2013 10:30 PM, Heesub Shin wrote:
> zbud_alloc() incorrectly verifies the size of allocation limit. It
> should deny the allocation request greater than (PAGE_SIZE -
> ZHDR_SIZE_ALIGNED - CHUNK_SIZE), not (PAGE_SIZE - ZHDR_SIZE_ALIGNED)
> which has no remaining spaces for its buddy. There is no point in
> spending the entire zbud page storing only a single page, since we don't
> have any benefits.
>
> Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
Looks good to me, although I'm thinking to make it more aggressive.
eg. minus two or three times of CHUNK_SIZE.
> ---
> mm/zbud.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/zbud.c b/mm/zbud.c
> index 9bb4710..ad1e781 100644
> --- a/mm/zbud.c
> +++ b/mm/zbud.c
> @@ -257,7 +257,7 @@ int zbud_alloc(struct zbud_pool *pool, int size, gfp_t gfp,
>
> if (size <= 0 || gfp & __GFP_HIGHMEM)
> return -EINVAL;
> - if (size > PAGE_SIZE - ZHDR_SIZE_ALIGNED)
> + if (size > PAGE_SIZE - ZHDR_SIZE_ALIGNED - CHUNK_SIZE)
> return -ENOSPC;
> chunks = size_to_chunks(size);
> spin_lock(&pool->lock);
>
--
Regards,
-Bob
--
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>
prev parent reply other threads:[~2013-07-18 12:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-17 14:30 Heesub Shin
2013-07-18 12:48 ` Bob Liu [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=51E7E400.4070705@oracle.com \
--to=bob.liu@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=d.j.shin@samsung.com \
--cc=heesub.shin@samsung.com \
--cc=heesub@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sjenning@linux.vnet.ibm.com \
--cc=sunae.seo@samsung.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