Skip to content

Commit 79a7f41

Browse files
committed
cgroup: cgroup refcnt functions should be exported when CONFIG_DEBUG_CGROUP_REF
6ab4286 ("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: 6ab4286 ("cgroup: Implement DEBUG_CGROUP_REF")
1 parent 6ab4286 commit 79a7f41

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

include/linux/cgroup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ void css_put(struct cgroup_subsys_state *css);
318318
void css_put_many(struct cgroup_subsys_state *css, unsigned int n);
319319
#else
320320
#define CGROUP_REF_FN_ATTRS static inline
321+
#define CGROUP_REF_EXPORT(fn)
321322
#include <linux/cgroup_refcnt.h>
322323
#endif
323324

include/linux/cgroup_refcnt.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ void css_get(struct cgroup_subsys_state *css)
1010
if (!(css->flags & CSS_NO_REF))
1111
percpu_ref_get(&css->refcnt);
1212
}
13+
CGROUP_REF_EXPORT(css_get)
1314

1415
/**
1516
* css_get_many - obtain references on the specified css
@@ -24,6 +25,7 @@ void css_get_many(struct cgroup_subsys_state *css, unsigned int n)
2425
if (!(css->flags & CSS_NO_REF))
2526
percpu_ref_get_many(&css->refcnt, n);
2627
}
28+
CGROUP_REF_EXPORT(css_get_many)
2729

2830
/**
2931
* css_tryget - try to obtain a reference on the specified css
@@ -43,6 +45,7 @@ bool css_tryget(struct cgroup_subsys_state *css)
4345
return percpu_ref_tryget(&css->refcnt);
4446
return true;
4547
}
48+
CGROUP_REF_EXPORT(css_tryget)
4649

4750
/**
4851
* css_tryget_online - try to obtain a reference on the specified css if online
@@ -61,6 +64,7 @@ bool css_tryget_online(struct cgroup_subsys_state *css)
6164
return percpu_ref_tryget_live(&css->refcnt);
6265
return true;
6366
}
67+
CGROUP_REF_EXPORT(css_tryget_online)
6468

6569
/**
6670
* css_put - put a css reference
@@ -74,6 +78,7 @@ void css_put(struct cgroup_subsys_state *css)
7478
if (!(css->flags & CSS_NO_REF))
7579
percpu_ref_put(&css->refcnt);
7680
}
81+
CGROUP_REF_EXPORT(css_put)
7782

7883
/**
7984
* css_put_many - put css references
@@ -88,3 +93,4 @@ void css_put_many(struct cgroup_subsys_state *css, unsigned int n)
8893
if (!(css->flags & CSS_NO_REF))
8994
percpu_ref_put_many(&css->refcnt, n);
9095
}
96+
CGROUP_REF_EXPORT(css_put_many)

kernel/cgroup/cgroup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ static int cgroup_addrm_files(struct cgroup_subsys_state *css,
250250

251251
#ifdef CONFIG_DEBUG_CGROUP_REF
252252
#define CGROUP_REF_FN_ATTRS noinline
253+
#define CGROUP_REF_EXPORT(fn) EXPORT_SYMBOL_GPL(fn);
253254
#include <linux/cgroup_refcnt.h>
254255
#endif
255256

0 commit comments

Comments
 (0)