mbox series

[v1,0/2] Add obj allocated counter for subpages

Message ID 20230619143506.45253-1-avromanov@sberdevices.ru (mailing list archive)
Headers show
Series Add obj allocated counter for subpages | expand

Message

Alexey Romanov June 19, 2023, 2:35 p.m. UTC
This patch series adds a count of allocated objects for each of the
zspage subpages. The main idea is that we can use the extra bytes
of the page_type field, because with PAGE_SIZE = 4096 we only use
the first two bytes there.

By storing the number of allocated objects, we can optimize, for
example, the running time of function find_allocated_obj, as well
as the entire compact algorithm as a whole. Also, counting allocated
objects has no effect on the performance of the entire zsmalloc:
bitwise operations are fast and we don't use any extra memory.

I also believe that we can also use this counter (maybe in the future)
in some other things, which will speed up the allocator even more.

Alexey Romanov (2):
  zsmalloc: add allocated objects counter for subpage
  zsmalloc: check empty page in find_alloced_obj

 mm/zsmalloc.c | 41 ++++++++++++++++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 3 deletions(-)