Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1309018 > unrolled thread

[PATCH 04/16] mm/slab: activate debug_pagealloc in SLAB when it is actually enabled

Started byJoonsoo Kim <js1304@gmail.com>
First post2016-01-14 06:30 +0100
Last post2016-01-14 17:20 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 04/16] mm/slab: activate debug_pagealloc in SLAB when it is actually enabled Joonsoo Kim <js1304@gmail.com> - 2016-01-14 06:30 +0100
    Re: [PATCH 04/16] mm/slab: activate debug_pagealloc in SLAB when it  is actually enabled Jesper Dangaard Brouer <brouer@redhat.com> - 2016-01-14 13:10 +0100
      Re: [PATCH 04/16] mm/slab: activate debug_pagealloc in SLAB when it  is actually enabled Joonsoo Kim <js1304@gmail.com> - 2016-01-14 17:20 +0100

#1309018 — [PATCH 04/16] mm/slab: activate debug_pagealloc in SLAB when it is actually enabled

FromJoonsoo Kim <js1304@gmail.com>
Date2016-01-14 06:30 +0100
Subject[PATCH 04/16] mm/slab: activate debug_pagealloc in SLAB when it is actually enabled
Message-ID<qQIDV-2oH-19@gated-at.bofh.it>
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);
 #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
-- 
1.9.1

[toc] | [next] | [standalone]


#1309211 — Re: [PATCH 04/16] mm/slab: activate debug_pagealloc in SLAB when it is actually enabled

FromJesper Dangaard Brouer <brouer@redhat.com>
Date2016-01-14 13:10 +0100
SubjectRe: [PATCH 04/16] mm/slab: activate debug_pagealloc in SLAB when it is actually enabled
Message-ID<qQOT0-6Lb-15@gated-at.bofh.it>
In reply to#1309018
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

[toc] | [prev] | [next] | [standalone]


#1309453 — Re: [PATCH 04/16] mm/slab: activate debug_pagealloc in SLAB when it is actually enabled

FromJoonsoo Kim <js1304@gmail.com>
Date2016-01-14 17:20 +0100
SubjectRe: [PATCH 04/16] mm/slab: activate debug_pagealloc in SLAB when it is actually enabled
Message-ID<qQSMW-14b-17@gated-at.bofh.it>
In reply to#1309211
2016-01-14 21:09 GMT+09:00 Jesper Dangaard Brouer <brouer@redhat.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).

I guess it is acceptable in the MM. :)
Moreover, it is cleaned-up in the following patch.
But, I hope to know how it is handled in the NET-area.

Thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web