All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] zsmalloc: use correct types in _first_obj_offset functions
@ 2022-09-09  8:37 Alexey Romanov
  2022-09-09  8:50 ` Sergey Senozhatsky
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Romanov @ 2022-09-09  8:37 UTC (permalink / raw)
  To: minchan, senozhatsky, ngupta, akpm
  Cc: linux-mm, linux-kernel, kernel, Alexey Romanov

Since commit ffedd09fa9b0
("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.

Fixes: ffedd09fa9b0 ("zsmalloc: Stop using slab fields in struct page")
Signed-off-by: Alexey Romanov <avromanov@sberdevices.ru>
---
 mm/zsmalloc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 7f833556e059..13c2a28521e8 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -472,12 +472,12 @@ static inline struct page *get_first_page(struct zspage *zspage)
 	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;
 }
 
-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;
 }
@@ -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,
 					struct page *page, int *obj_idx)
 {
-	int offset = 0;
+	unsigned int offset;
 	int index = *obj_idx;
 	unsigned long handle = 0;
 	void *addr = kmap_atomic(page);
@@ -1846,7 +1846,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page,
 	struct zspage *zspage;
 	struct page *dummy;
 	void *s_addr, *d_addr, *addr;
-	int offset;
+	unsigned int offset;
 	unsigned long handle;
 	unsigned long old_obj, new_obj;
 	unsigned int obj_idx;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] zsmalloc: use correct types in _first_obj_offset functions
  2022-09-09  8:37 [PATCH v1] zsmalloc: use correct types in _first_obj_offset functions Alexey Romanov
@ 2022-09-09  8:50 ` Sergey Senozhatsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sergey Senozhatsky @ 2022-09-09  8:50 UTC (permalink / raw)
  To: Alexey Romanov
  Cc: minchan, senozhatsky, ngupta, akpm, linux-mm, linux-kernel,
	kernel

On (22/09/09 11:37), Alexey Romanov wrote:
> Since commit ffedd09fa9b0
> ("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.
> 
> Fixes: ffedd09fa9b0 ("zsmalloc: Stop using slab fields in struct page")
> Signed-off-by: Alexey Romanov <avromanov@sberdevices.ru>

Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-09  8:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-09  8:37 [PATCH v1] zsmalloc: use correct types in _first_obj_offset functions Alexey Romanov
2022-09-09  8:50 ` Sergey Senozhatsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.