linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@cs.helsinki.fi>
To: Paul Mundt <lethal@linux-sh.org>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	David Howells <dhowells@redhat.com>,
	Christoph Lameter <clameter@sgi.com>,
	Matt Mackall <mpm@selenic.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH] nommu: Push kobjsize() slab-specific logic down to ksize().
Date: Wed, 21 May 2008 17:58:12 +0300	[thread overview]
Message-ID: <48343884.7060708@cs.helsinki.fi> (raw)
In-Reply-To: <20080520095935.GB18633@linux-sh.org>

(Not really sure if we came to a conclusion with the discussion.)

Paul Mundt wrote:
> diff --git a/mm/nommu.c b/mm/nommu.c
> index ef8c62c..3e11814 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -112,13 +112,7 @@ unsigned int kobjsize(const void *objp)
>  	if (!objp || (unsigned long)objp >= memory_end || !((page = virt_to_page(objp))))
>  		return 0;
>  
> -	if (PageSlab(page))
> -		return ksize(objp);
> -
> -	BUG_ON(page->index < 0);
> -	BUG_ON(page->index >= MAX_ORDER);
> -
> -	return (PAGE_SIZE << page->index);
> +	return ksize(objp);
>  }
>  
>  /*
> diff --git a/mm/slab.c b/mm/slab.c
> index 06236e4..7a012bb 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -4472,10 +4472,16 @@ const struct seq_operations slabstats_op = {
>   */
>  size_t ksize(const void *objp)
>  {
> +	struct page *page;
> +
>  	BUG_ON(!objp);
>  	if (unlikely(objp == ZERO_SIZE_PTR))
>  		return 0;
>  
> +	page = virt_to_head_page(objp);
> +	if (unlikely(!PageSlab(page)))
> +		return PAGE_SIZE << compound_order(page);
> +
>  	return obj_size(virt_to_cache(objp));
>  }
>  EXPORT_SYMBOL(ksize);

The patch looks good to me. Christoph, Matt, NAK/ACK?

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

  parent reply	other threads:[~2008-05-21 14:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-20  9:59 [PATCH] nommu: Push kobjsize() slab-specific logic down to ksize() Paul Mundt
2008-05-20 15:18 ` David Howells
2008-05-20 16:52   ` Christoph Lameter
2008-05-20 18:23     ` Matt Mackall
2008-05-20 18:51       ` Christoph Lameter
2008-05-20 19:00         ` Matt Mackall
2008-05-20 19:08           ` Christoph Lameter
2008-05-20 19:14             ` Matt Mackall
2008-05-20 19:16               ` Christoph Lameter
2008-05-20 21:22                 ` Matt Mackall
2008-05-21  1:19                   ` Paul Mundt
2008-05-21  1:52                     ` Christoph Lameter
2008-05-22  4:23     ` Pekka Enberg
2008-05-20 16:29 ` Matt Mackall
2008-05-21  2:43   ` Paul Mundt
2008-05-21 14:58 ` Pekka Enberg [this message]
2008-05-21 15:06   ` Matt Mackall
2008-05-21 17:13 ` Pekka J Enberg
2008-05-21 17:27   ` Christoph Lameter
2008-05-21 19:08   ` Pekka Enberg
2008-05-21 23:43   ` Paul Mundt
2008-05-22  0:01     ` Christoph Lameter

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=48343884.7060708@cs.helsinki.fi \
    --to=penberg@cs.helsinki.fi \
    --cc=clameter@sgi.com \
    --cc=dhowells@redhat.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-mm@kvack.org \
    --cc=mpm@selenic.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;
as well as URLs for NNTP newsgroup(s).