linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Joonsoo Kim <js1304@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	brouer@redhat.com
Subject: Re: [PATCH 04/16] mm/slab: activate debug_pagealloc in SLAB when it is actually enabled
Date: Thu, 14 Jan 2016 13:09:19 +0100	[thread overview]
Message-ID: <20160114130919.48254935@redhat.com> (raw)
In-Reply-To: <1452749069-15334-5-git-send-email-iamjoonsoo.kim@lge.com>

On Thu, 14 Jan 2016 14:24:17 +0900
Joonsoo Kim <js1304@gmail.com> wrote:

> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> ---
>  mm/slab.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/slab.c b/mm/slab.c
> index bbe4df2..4b55516 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -1838,7 +1838,8 @@ static void slab_destroy_debugcheck(struct kmem_cache *cachep,
>  
>  		if (cachep->flags & SLAB_POISON) {
>  #ifdef CONFIG_DEBUG_PAGEALLOC
> -			if (cachep->size % PAGE_SIZE == 0 &&
> +			if (debug_pagealloc_enabled() &&
> +				cachep->size % PAGE_SIZE == 0 &&
>  					OFF_SLAB(cachep))
>  				kernel_map_pages(virt_to_page(objp),
>  					cachep->size / PAGE_SIZE, 1);
> @@ -2176,7 +2177,8 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
>  	 * to check size >= 256. It guarantees that all necessary small
>  	 * sized slab is initialized in current slab initialization sequence.
>  	 */
> -	if (!slab_early_init && size >= kmalloc_size(INDEX_NODE) &&
> +	if (debug_pagealloc_enabled() &&
> +		!slab_early_init && size >= kmalloc_size(INDEX_NODE) &&
>  		size >= 256 && cachep->object_size > cache_line_size() &&
>  		ALIGN(size, cachep->align) < PAGE_SIZE) {
>  		cachep->obj_offset += PAGE_SIZE - ALIGN(size, cachep->align);
> @@ -2232,7 +2234,8 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
>  		 * poisoning, then it's going to smash the contents of
>  		 * the redzone and userword anyhow, so switch them off.
>  		 */
> -		if (size % PAGE_SIZE == 0 && flags & SLAB_POISON)
> +		if (debug_pagealloc_enabled() &&
> +			size % PAGE_SIZE == 0 && flags & SLAB_POISON)
>  			flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);

Sorry, but I dislike the indention style here (when the if covers
several lines). Same goes for other changes in this patch.  Looking,
there are several example of this indention style in the existing
mm/slab.c. Thus, I don't know if this is accepted in the MM area (it is
definitely not accepted in the NET-area).


>  #endif
>  	}
> @@ -2716,7 +2719,8 @@ static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp,
>  	set_obj_status(page, objnr, OBJECT_FREE);
>  	if (cachep->flags & SLAB_POISON) {
>  #ifdef CONFIG_DEBUG_PAGEALLOC
> -		if ((cachep->size % PAGE_SIZE)==0 && OFF_SLAB(cachep)) {
> +		if (debug_pagealloc_enabled() &&
> +			(cachep->size % PAGE_SIZE) == 0 && OFF_SLAB(cachep)) {
>  			store_stackinfo(cachep, objp, caller);
>  			kernel_map_pages(virt_to_page(objp),
>  					 cachep->size / PAGE_SIZE, 0);
> @@ -2861,7 +2865,8 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep,
>  		return objp;
>  	if (cachep->flags & SLAB_POISON) {
>  #ifdef CONFIG_DEBUG_PAGEALLOC
> -		if ((cachep->size % PAGE_SIZE) == 0 && OFF_SLAB(cachep))
> +		if (debug_pagealloc_enabled() &&
> +			(cachep->size % PAGE_SIZE) == 0 && OFF_SLAB(cachep))
>  			kernel_map_pages(virt_to_page(objp),
>  					 cachep->size / PAGE_SIZE, 1);
>  		else



-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  Author of http://www.iptv-analyzer.org
  LinkedIn: http://www.linkedin.com/in/brouer

--
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:[~2016-01-14 12:09 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-14  5:24 [PATCH 00/16] mm/slab: introduce new freed objects management way, OBJFREELIST_SLAB Joonsoo Kim
2016-01-14  5:24 ` [PATCH 01/16] mm/slab: fix stale code comment Joonsoo Kim
2016-01-14 15:22   ` Christoph Lameter
2016-01-14  5:24 ` [PATCH 02/16] mm/slab: remove useless structure define Joonsoo Kim
2016-01-14 15:22   ` Christoph Lameter
2016-01-14  5:24 ` [PATCH 03/16] mm/slab: remove the checks for slab implementation bug Joonsoo Kim
2016-01-14 15:23   ` Christoph Lameter
2016-01-14 16:20     ` Joonsoo Kim
2016-01-14  5:24 ` [PATCH 04/16] mm/slab: activate debug_pagealloc in SLAB when it is actually enabled Joonsoo Kim
2016-01-14 12:09   ` Jesper Dangaard Brouer [this message]
2016-01-14 16:16     ` Joonsoo Kim
2016-01-14  5:24 ` [PATCH 05/16] mm/slab: use more appropriate condition check for debug_pagealloc Joonsoo Kim
2016-01-14  5:24 ` [PATCH 06/16] mm/slab: clean-up DEBUG_PAGEALLOC processing code Joonsoo Kim
2016-01-14  5:24 ` [PATCH 07/16] mm/slab: alternative implementation for DEBUG_SLAB_LEAK Joonsoo Kim
2016-01-14  5:24 ` [PATCH 08/16] mm/slab: remove object status buffer " Joonsoo Kim
2016-01-14  5:24 ` [PATCH 09/16] mm/slab: put the freelist at the end of slab page Joonsoo Kim
2016-01-14 15:26   ` Christoph Lameter
2016-01-14 16:21     ` Joonsoo Kim
2016-01-14 17:13   ` Christoph Lameter
2016-01-14  5:24 ` [PATCH 10/16] mm/slab: align cache size first before determination of OFF_SLAB candidate Joonsoo Kim
2016-01-14  5:24 ` [PATCH 11/16] mm/slab: clean-up cache type determination Joonsoo Kim
2016-01-14  5:24 ` [PATCH 12/16] mm/slab: do not change cache size if debug pagealloc isn't possible Joonsoo Kim
2016-01-14  5:24 ` [PATCH 13/16] mm/slab: make criteria for off slab determination robust and simple Joonsoo Kim
2016-01-14  5:24 ` [PATCH 14/16] mm/slab: factor out slab list fixup code Joonsoo Kim
2016-01-14  5:24 ` [PATCH 15/16] mm/slab: factor out debugging initialization in cache_init_objs() Joonsoo Kim
2016-01-14  5:24 ` [PATCH 16/16] mm/slab: introduce new slab management type, OBJFREELIST_SLAB Joonsoo Kim
2016-01-14 15:32   ` Christoph Lameter
2016-01-14 16:24     ` Joonsoo Kim
2016-01-27 13:35   ` Vlastimil Babka
2016-01-27 16:48     ` Christoph Lameter
2016-01-27 17:18       ` Vlastimil Babka
2016-01-27 17:55         ` Christoph Lameter
2016-01-28  4:51     ` Joonsoo Kim
2016-01-29 15:21       ` Vlastimil Babka
2016-01-27  4:40 ` [PATCH 00/16] mm/slab: introduce new freed objects management way, OBJFREELIST_SLAB Andrew Morton
2016-01-27  4:46   ` Joonsoo Kim

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=20160114130919.48254935@redhat.com \
    --to=brouer@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=js1304@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.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).