[PATCH] hugetlb: fix <linux/hugetlb_cgroup.h> structs
From: Randy Dunlap
Date: Sun Feb 16 2020 - 21:57:57 EST
On 2/16/20 6:48 PM, Randy Dunlap wrote:
> On 2/16/20 1:03 PM, Mina Almasry wrote:
>> On Sun, Feb 16, 2020 at 12:40 PM Mina Almasry <almasrymina@xxxxxxxxxx> wrote:
>>>
>> any insight into why I can't reproduce the
>> warning? Wrong tree perhaps?
>>
>> I suspect a forward declaration of struct resv_map and struct
>> file_region in hugetlb_cgroup.h would also fix.
Yes, adding struct stubs in that header file does remove the
build warnings.
thanks.
=== patch follows ===
From: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Fix build warnings when CONFIG_HUGETLB is not set/enabled.
Fixes these warnings:
In file included from ../mm/migrate.c:39:0:
../include/linux/hugetlb_cgroup.h:147:21: warning: âstruct file_regionâ declared inside parameter list will not be visible outside of this definition or declaration
struct file_region *rg,
^~~~~~~~~~~
../include/linux/hugetlb_cgroup.h:146:63: warning: âstruct resv_mapâ declared inside parameter list will not be visible outside of this definition or declaration
static inline void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv,
^~~~~~~~
../include/linux/hugetlb_cgroup.h:234:59: warning: âstruct resv_mapâ declared inside parameter list will not be visible outside of this definition or declaration
static inline void hugetlb_cgroup_uncharge_counter(struct resv_map *resv,
^~~~~~~~
Suggested-by: Mina Almasry <almasrymina@xxxxxxxxxx>
Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
---
include/linux/hugetlb_cgroup.h | 3 +++
1 file changed, 3 insertions(+)
--- mmotm-2020-0213-2226.orig/include/linux/hugetlb_cgroup.h
+++ mmotm-2020-0213-2226/include/linux/hugetlb_cgroup.h
@@ -18,6 +18,9 @@
#include <linux/mmdebug.h>
struct hugetlb_cgroup;
+struct file_region;
+struct resv_map;
+
/*
* Minimum page order trackable by hugetlb cgroup.
* At least 4 pages are necessary for all the tracking information.