Skip to contentSkip to conversation

slub: init_kmem_cache_cpus() and put_cpu_partial() can be static

PATCH In review Fengguang Wu 3 participants 5 messages Sep 28, 2012 – Oct 3, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 slub: init_kmem_cache_cpus() and put_cpu_partial() can be static

---
 mm/slub.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/slub.c +2 -2
@@ -1709,7 +1709,7 @@ static inline void note_cmpxchg_failure(
 	stat(s, CMPXCHG_DOUBLE_CPU_FAIL);
 }
 
-void init_kmem_cache_cpus(struct kmem_cache *s)
+static void init_kmem_cache_cpus(struct kmem_cache *s)
 {
 	int cpu;
 
@@ -1934,7 +1934,7 @@ static void unfreeze_partials(struct kme
  * If we did not find a slot then simply move all the partials to the
  * per node partial list.
  */
-int put_cpu_partial(struct kmem_cache *s, struct page *page, int drain)
+static int put_cpu_partial(struct kmem_cache *s, struct page *page, int drain)
 {
 	struct page *oldpage;
 	int pages;

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

reviewer Acked-by on v1 1/1
#2 lore raw
In reply to Fengguang Wu
Quoted 2 lines · Fengguang Wu

I think init_kmem_cache_cpus() would also benefit from just being inlined into alloc_kmem_cache_cpus().

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

#3 lore raw
Quoted 9 lines · David Rientjes
Quoted 2 lines · Fengguang Wu

I think init_kmem_cache_cpus() would also benefit from just being inlined into alloc_kmem_cache_cpus().

The compiler will do that if it is advantageous.

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

#4 lore raw
Quoted 10 lines · Christoph Lameter
Quoted 7 lines
Quoted 2 lines

I think init_kmem_cache_cpus() would also benefit from just being inlined into alloc_kmem_cache_cpus().

The compiler will do that if it is advantageous.

Which it obviously does with -O2, but I think it would be advantageous to do this at the source code level as well since we have a function with a single caller, which happens to be marked inline itself, but we're not inline. It seems cleaner to me, but it's only a suggestion. Thanks.

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