mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:24:45 +01:00
mm/zsmalloc: convert location_to_obj() to take zpdesc
As all users of location_to_obj() now use zpdesc, convert location_to_obj() to take zpdesc. Link: https://lkml.kernel.org/r/20241216150450.1228021-14-42.hyeyoo@gmail.com Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi <alexs@kernel.org> Acked-by: Sergey Senozhatsky <senozhatsky@chromium.org> Tested-by: Sergey Senozhatsky <senozhatsky@chromium.org> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Minchan Kim <minchan@kernel.org> Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
7f0b0c6642
commit
2d57eb9ea9
1 changed files with 6 additions and 7 deletions
|
|
@ -804,15 +804,15 @@ static void obj_to_zpdesc(unsigned long obj, struct zpdesc **zpdesc)
|
|||
}
|
||||
|
||||
/**
|
||||
* location_to_obj - get obj value encoded from (<page>, <obj_idx>)
|
||||
* @page: page object resides in zspage
|
||||
* location_to_obj - get obj value encoded from (<zpdesc>, <obj_idx>)
|
||||
* @zpdesc: zpdesc object resides in zspage
|
||||
* @obj_idx: object index
|
||||
*/
|
||||
static unsigned long location_to_obj(struct page *page, unsigned int obj_idx)
|
||||
static unsigned long location_to_obj(struct zpdesc *zpdesc, unsigned int obj_idx)
|
||||
{
|
||||
unsigned long obj;
|
||||
|
||||
obj = page_to_pfn(page) << OBJ_INDEX_BITS;
|
||||
obj = zpdesc_pfn(zpdesc) << OBJ_INDEX_BITS;
|
||||
obj |= obj_idx & OBJ_INDEX_MASK;
|
||||
|
||||
return obj;
|
||||
|
|
@ -1358,7 +1358,7 @@ static unsigned long obj_malloc(struct zs_pool *pool,
|
|||
kunmap_local(vaddr);
|
||||
mod_zspage_inuse(zspage, 1);
|
||||
|
||||
obj = location_to_obj(zpdesc_page(m_zpdesc), obj);
|
||||
obj = location_to_obj(m_zpdesc, obj);
|
||||
record_obj(handle, obj);
|
||||
|
||||
return obj;
|
||||
|
|
@ -1845,8 +1845,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page,
|
|||
|
||||
old_obj = handle_to_obj(handle);
|
||||
obj_to_location(old_obj, &dummy, &obj_idx);
|
||||
new_obj = (unsigned long)location_to_obj(zpdesc_page(newzpdesc),
|
||||
obj_idx);
|
||||
new_obj = (unsigned long)location_to_obj(newzpdesc, obj_idx);
|
||||
record_obj(handle, new_obj);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue