Commit 4d0a5402 authored by Colin Ian King's avatar Colin Ian King Committed by Linus Torvalds

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.comSigned-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent dcfe4df3
...@@ -924,20 +924,7 @@ static void reset_page(struct page *page) ...@@ -924,20 +924,7 @@ static void reset_page(struct page *page)
page->freelist = NULL; page->freelist = NULL;
} }
/* static int trylock_zspage(struct zspage *zspage)
* To prevent zspage destroy during migration, zspage freeing should
* hold locks of all pages in the zspage.
*/
void lock_zspage(struct zspage *zspage)
{
struct page *page = get_first_page(zspage);
do {
lock_page(page);
} while ((page = get_next_page(page)) != NULL);
}
int trylock_zspage(struct zspage *zspage)
{ {
struct page *cursor, *fail; struct page *cursor, *fail;
...@@ -1814,6 +1801,19 @@ static enum fullness_group putback_zspage(struct size_class *class, ...@@ -1814,6 +1801,19 @@ static enum fullness_group putback_zspage(struct size_class *class,
} }
#ifdef CONFIG_COMPACTION #ifdef CONFIG_COMPACTION
/*
* To prevent zspage destroy during migration, zspage freeing should
* hold locks of all pages in the zspage.
*/
static void lock_zspage(struct zspage *zspage)
{
struct page *page = get_first_page(zspage);
do {
lock_page(page);
} while ((page = get_next_page(page)) != NULL);
}
static struct dentry *zs_mount(struct file_system_type *fs_type, static struct dentry *zs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data) int flags, const char *dev_name, void *data)
{ {
...@@ -1905,7 +1905,7 @@ static void replace_sub_page(struct size_class *class, struct zspage *zspage, ...@@ -1905,7 +1905,7 @@ static void replace_sub_page(struct size_class *class, struct zspage *zspage,
__SetPageMovable(newpage, page_mapping(oldpage)); __SetPageMovable(newpage, page_mapping(oldpage));
} }
bool zs_page_isolate(struct page *page, isolate_mode_t mode) static bool zs_page_isolate(struct page *page, isolate_mode_t mode)
{ {
struct zs_pool *pool; struct zs_pool *pool;
struct size_class *class; struct size_class *class;
...@@ -1960,7 +1960,7 @@ bool zs_page_isolate(struct page *page, isolate_mode_t mode) ...@@ -1960,7 +1960,7 @@ bool zs_page_isolate(struct page *page, isolate_mode_t mode)
return true; return true;
} }
int zs_page_migrate(struct address_space *mapping, struct page *newpage, static int zs_page_migrate(struct address_space *mapping, struct page *newpage,
struct page *page, enum migrate_mode mode) struct page *page, enum migrate_mode mode)
{ {
struct zs_pool *pool; struct zs_pool *pool;
...@@ -2076,7 +2076,7 @@ int zs_page_migrate(struct address_space *mapping, struct page *newpage, ...@@ -2076,7 +2076,7 @@ int zs_page_migrate(struct address_space *mapping, struct page *newpage,
return ret; return ret;
} }
void zs_page_putback(struct page *page) static void zs_page_putback(struct page *page)
{ {
struct zs_pool *pool; struct zs_pool *pool;
struct size_class *class; struct size_class *class;
...@@ -2108,7 +2108,7 @@ void zs_page_putback(struct page *page) ...@@ -2108,7 +2108,7 @@ void zs_page_putback(struct page *page)
spin_unlock(&class->lock); spin_unlock(&class->lock);
} }
const struct address_space_operations zsmalloc_aops = { static const struct address_space_operations zsmalloc_aops = {
.isolate_page = zs_page_isolate, .isolate_page = zs_page_isolate,
.migratepage = zs_page_migrate, .migratepage = zs_page_migrate,
.putback_page = zs_page_putback, .putback_page = zs_page_putback,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment