Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cgroup: cgroup refcnt functions should be exported when CONFIG_DEBUG_CGROUP_REF

6ab428604f72 ("cgroup: Implement DEBUG_CGROUP_REF") added a config option
which forces cgroup refcnt functions to be not inlined so that they can be
kprobed for debugging. However, it forgot export them when the config is
enabled breaking modules which make use of css reference counting.

Fix it by adding CGROUP_REF_EXPORT() macro to cgroup_refcnt.h which is
defined to EXPORT_SYMBOL_GPL when CONFIG_DEBUG_CGROUP_REF is set.

Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: 6ab428604f72 ("cgroup: Implement DEBUG_CGROUP_REF")

+8
+1
include/linux/cgroup.h
··· 318 318 void css_put_many(struct cgroup_subsys_state *css, unsigned int n); 319 319 #else 320 320 #define CGROUP_REF_FN_ATTRS static inline 321 + #define CGROUP_REF_EXPORT(fn) 321 322 #include <linux/cgroup_refcnt.h> 322 323 #endif 323 324
+6
include/linux/cgroup_refcnt.h
··· 10 10 if (!(css->flags & CSS_NO_REF)) 11 11 percpu_ref_get(&css->refcnt); 12 12 } 13 + CGROUP_REF_EXPORT(css_get) 13 14 14 15 /** 15 16 * css_get_many - obtain references on the specified css ··· 25 24 if (!(css->flags & CSS_NO_REF)) 26 25 percpu_ref_get_many(&css->refcnt, n); 27 26 } 27 + CGROUP_REF_EXPORT(css_get_many) 28 28 29 29 /** 30 30 * css_tryget - try to obtain a reference on the specified css ··· 45 43 return percpu_ref_tryget(&css->refcnt); 46 44 return true; 47 45 } 46 + CGROUP_REF_EXPORT(css_tryget) 48 47 49 48 /** 50 49 * css_tryget_online - try to obtain a reference on the specified css if online ··· 64 61 return percpu_ref_tryget_live(&css->refcnt); 65 62 return true; 66 63 } 64 + CGROUP_REF_EXPORT(css_tryget_online) 67 65 68 66 /** 69 67 * css_put - put a css reference ··· 78 74 if (!(css->flags & CSS_NO_REF)) 79 75 percpu_ref_put(&css->refcnt); 80 76 } 77 + CGROUP_REF_EXPORT(css_put) 81 78 82 79 /** 83 80 * css_put_many - put css references ··· 93 88 if (!(css->flags & CSS_NO_REF)) 94 89 percpu_ref_put_many(&css->refcnt, n); 95 90 } 91 + CGROUP_REF_EXPORT(css_put_many)
+1
kernel/cgroup/cgroup.c
··· 250 250 251 251 #ifdef CONFIG_DEBUG_CGROUP_REF 252 252 #define CGROUP_REF_FN_ATTRS noinline 253 + #define CGROUP_REF_EXPORT(fn) EXPORT_SYMBOL_GPL(fn); 253 254 #include <linux/cgroup_refcnt.h> 254 255 #endif 255 256