summaryrefslogtreecommitdiffstats
path: root/mm/zsmalloc.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2018-08-17 18:46:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-17 19:20:30 -0400
commit4d0a5402f505eafe5b0a77f2dc77bb6c2e25a714 (patch)
tree086650b11c3478731497fa43d8e257afa7abb132 /mm/zsmalloc.c
parentdcfe4df3d57f08f7bf4acdd36c89763fe188cf3c (diff)
mm/zsmalloc.c: make several functions and a struct static
The functions zs_page_isolate, zs_page_migrate, zs_page_putback, lock_zspage, trylock_zspage and structure zsmalloc_aops are local to source and do not need to be in global scope, so make them static. Cleans up sparse warnings: symbol 'zs_page_isolate' was not declared. Should it be static? symbol 'zs_page_migrate' was not declared. Should it be static? symbol 'zs_page_putback' was not declared. Should it be static? symbol 'zsmalloc_aops' was not declared. Should it be static? symbol 'lock_zspage' was not declared. Should it be static? symbol 'trylock_zspage' was not declared. Should it be static? [arnd@arndb.de: hide unused lock_zspage] Link: http://lkml.kernel.org/r/20180706130924.3891230-1-arnd@arndb.de Link: http://lkml.kernel.org/r/20180624213322.13776-1-colin.king@canonical.com Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Minchan Kim <minchan@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/zsmalloc.c')
-rw-r--r--mm/zsmalloc.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 8d87e973a4f5..9da65552e7ca 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -924,20 +924,7 @@ static void reset_page(struct page *page)
924 page->freelist = NULL; 924 page->freelist = NULL;
925} 925}
926 926
927/* 927static int trylock_zspage(struct zspage *zspage)
928 * To prevent zspage destroy during migration, zspage freeing should
929 * hold locks of all pages in the zspage.
930 */
931void lock_zspage(struct zspage *zspage)
932{
933 struct page *page = get_first_page(zspage);
934
935 do {
936 lock_page(page);
937 } while ((page = get_next_page(page)) != NULL);
938}
939
940int trylock_zspage(struct zspage *zspage)
941{ 928{
942 struct page *cursor, *fail; 929 struct page *cursor, *fail;
943 930
@@ -1814,6 +1801,19 @@ static enum fullness_group putback_zspage(struct size_class *class,
1814} 1801}
1815 1802
1816#ifdef CONFIG_COMPACTION 1803#ifdef CONFIG_COMPACTION
1804/*
1805 * To prevent zspage destroy during migration, zspage freeing should
1806 * hold locks of all pages in the zspage.
1807 */
1808static void lock_zspage(struct zspage *zspage)
1809{
1810 struct page *page = get_first_page(zspage);
1811
1812 do {
1813 lock_page(page);
1814 } while ((page = get_next_page(page)) != NULL);
1815}
1816
1817static struct dentry *zs_mount(struct file_system_type *fs_type, 1817static struct dentry *zs_mount(struct file_system_type *fs_type,
1818 int flags, const char *dev_name, void *data) 1818 int flags, const char *dev_name, void *data)
1819{ 1819{
@@ -1905,7 +1905,7 @@ static void replace_sub_page(struct size_class *class, struct zspage *zspage,
1905 __SetPageMovable(newpage, page_mapping(oldpage)); 1905 __SetPageMovable(newpage, page_mapping(oldpage));
1906} 1906}
1907 1907
1908bool zs_page_isolate(struct page *page, isolate_mode_t mode) 1908static bool zs_page_isolate(struct page *page, isolate_mode_t mode)
1909{ 1909{
1910 struct zs_pool *pool; 1910 struct zs_pool *pool;
1911 struct size_class *class; 1911 struct size_class *class;
@@ -1960,7 +1960,7 @@ bool zs_page_isolate(struct page *page, isolate_mode_t mode)
1960 return true; 1960 return true;
1961} 1961}
1962 1962
1963int zs_page_migrate(struct address_space *mapping, struct page *newpage, 1963static int zs_page_migrate(struct address_space *mapping, struct page *newpage,
1964 struct page *page, enum migrate_mode mode) 1964 struct page *page, enum migrate_mode mode)
1965{ 1965{
1966 struct zs_pool *pool; 1966 struct zs_pool *pool;
@@ -2076,7 +2076,7 @@ unpin_objects:
2076 return ret; 2076 return ret;
2077} 2077}
2078 2078
2079void zs_page_putback(struct page *page) 2079static void zs_page_putback(struct page *page)
2080{ 2080{
2081 struct zs_pool *pool; 2081 struct zs_pool *pool;
2082 struct size_class *class; 2082 struct size_class *class;
@@ -2108,7 +2108,7 @@ void zs_page_putback(struct page *page)
2108 spin_unlock(&class->lock); 2108 spin_unlock(&class->lock);
2109} 2109}
2110 2110
2111const struct address_space_operations zsmalloc_aops = { 2111static const struct address_space_operations zsmalloc_aops = {
2112 .isolate_page = zs_page_isolate, 2112 .isolate_page = zs_page_isolate,
2113 .migratepage = zs_page_migrate, 2113 .migratepage = zs_page_migrate,
2114 .putback_page = zs_page_putback, 2114 .putback_page = zs_page_putback,