[PATCH -mmotm v2] mm: fix kmemcheck.c build errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/31/14 07:48, Randy Dunlap wrote:
> On 08/31/14 04:36, Andrey Ryabinin wrote:
>> 2014-08-30 5:48 GMT+04:00 Randy Dunlap <rdunlap@xxxxxxxxxxxxx>:
>>> From: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
>>>
>>> Add header file to fix kmemcheck.c build errors:
>>>
>>> ../mm/kmemcheck.c:70:7: error: dereferencing pointer to incomplete type
>>> ../mm/kmemcheck.c:83:15: error: dereferencing pointer to incomplete type
>>> ../mm/kmemcheck.c:95:8: error: dereferencing pointer to incomplete type
>>> ../mm/kmemcheck.c:95:21: error: dereferencing pointer to incomplete type
>>>
>>> Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
>>> ---
>>>  mm/kmemcheck.c |    1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> Index: mmotm-2014-0829-1515/mm/kmemcheck.c
>>> ===================================================================
>>> --- mmotm-2014-0829-1515.orig/mm/kmemcheck.c
>>> +++ mmotm-2014-0829-1515/mm/kmemcheck.c
>>> @@ -2,6 +2,7 @@
>>>  #include <linux/mm_types.h>
>>>  #include <linux/mm.h>
>>>  #include <linux/slab.h>
>>> +#include <linux/slab_def.h>
>>
>> This will work only for CONFIG_SLAB=y. struct kmem_cache definition
>> was moved to internal header [*],
>> so you need to include it here:
>> #include "slab.h"
>>
>> [*] http://ozlabs.org/~akpm/mmotm/broken-out/mm-slab_common-move-kmem_cache-definition-to-internal-header.patch
> 
> Thanks.  That makes sense.  [testing]  mm/kmemcheck.c still has a build error:
> 
> In file included from ../mm/kmemcheck.c:5:0:
> ../mm/slab.h: In function 'cache_from_obj':
> ../mm/slab.h:283:2: error: implicit declaration of function 'memcg_kmem_enabled' [-Werror=implicit-function-declaration]
> 

Naughty header file.  It uses something from <linux/memcontrol.h> without
#including that header file...

Working patch is below.

> 
> Maybe Andrew should just drop that patch and its associated patches.
> 
> 
>>>  #include <linux/kmemcheck.h>
>>>
>>>  void kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node)



From: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>

Add header files to fix kmemcheck.c build errors:

../mm/kmemcheck.c:70:7: error: dereferencing pointer to incomplete type
../mm/kmemcheck.c:83:15: error: dereferencing pointer to incomplete type
../mm/kmemcheck.c:95:8: error: dereferencing pointer to incomplete type
../mm/kmemcheck.c:95:21: error: dereferencing pointer to incomplete type

../mm/slab.h: In function 'cache_from_obj':
../mm/slab.h:283:2: error: implicit declaration of function 'memcg_kmem_enabled' [-Werror=implicit-function-declaration]

Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
---
 mm/kmemcheck.c |    1 +
 mm/slab.h      |    2 ++
 2 files changed, 3 insertions(+)

Index: mmotm-2014-0829-1515/mm/kmemcheck.c
===================================================================
--- mmotm-2014-0829-1515.orig/mm/kmemcheck.c
+++ mmotm-2014-0829-1515/mm/kmemcheck.c
@@ -2,6 +2,7 @@
 #include <linux/mm_types.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
+#include "slab.h"
 #include <linux/kmemcheck.h>
 
 void kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node)
Index: mmotm-2014-0829-1515/mm/slab.h
===================================================================
--- mmotm-2014-0829-1515.orig/mm/slab.h
+++ mmotm-2014-0829-1515/mm/slab.h
@@ -268,6 +268,8 @@ static inline void memcg_uncharge_slab(s
 }
 #endif
 
+#include <linux/memcontrol.h>
+
 static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x)
 {
 	struct kmem_cache *cachep;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]