Commit 671f2fa8 authored by Alexey Romanov's avatar Alexey Romanov Committed by Andrew Morton

zsmalloc: use correct types in _first_obj_offset functions

Since commit ffedd09f ("zsmalloc: Stop using slab fields in struct
page") we are using page->page_type (unsigned int) field instead of
page->units (int) as first object offset in a subpage of zspage.  So
get_first_obj_offset() and set_first_obj_offset() functions should work
with unsigned int type.

Link: https://lkml.kernel.org/r/20220909083722.85024-1-avromanov@sberdevices.ru
Fixes: ffedd09f ("zsmalloc: Stop using slab fields in struct page")
Signed-off-by: default avatarAlexey Romanov <avromanov@sberdevices.ru>
Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Cc: Alexey Romanov <avromanov@sberdevices.ru>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 85a34107
...@@ -472,12 +472,12 @@ static inline struct page *get_first_page(struct zspage *zspage) ...@@ -472,12 +472,12 @@ static inline struct page *get_first_page(struct zspage *zspage)
return first_page; return first_page;
} }
static inline int get_first_obj_offset(struct page *page) static inline unsigned int get_first_obj_offset(struct page *page)
{ {
return page->page_type; return page->page_type;
} }
static inline void set_first_obj_offset(struct page *page, int offset) static inline void set_first_obj_offset(struct page *page, unsigned int offset)
{ {
page->page_type = offset; page->page_type = offset;
} }
...@@ -1592,7 +1592,7 @@ static void zs_object_copy(struct size_class *class, unsigned long dst, ...@@ -1592,7 +1592,7 @@ static void zs_object_copy(struct size_class *class, unsigned long dst,
static unsigned long find_alloced_obj(struct size_class *class, static unsigned long find_alloced_obj(struct size_class *class,
struct page *page, int *obj_idx) struct page *page, int *obj_idx)
{ {
int offset = 0; unsigned int offset;
int index = *obj_idx; int index = *obj_idx;
unsigned long handle = 0; unsigned long handle = 0;
void *addr = kmap_atomic(page); void *addr = kmap_atomic(page);
...@@ -1846,7 +1846,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, ...@@ -1846,7 +1846,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page,
struct zspage *zspage; struct zspage *zspage;
struct page *dummy; struct page *dummy;
void *s_addr, *d_addr, *addr; void *s_addr, *d_addr, *addr;
int offset; unsigned int offset;
unsigned long handle; unsigned long handle;
unsigned long old_obj, new_obj; unsigned long old_obj, new_obj;
unsigned int obj_idx; unsigned int obj_idx;
......
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