lib: cpu_rmap: Use allocator for rmap entries
authorEli Cohen <elic@nvidia.com>
Tue, 14 Feb 2023 07:29:46 +0000 (09:29 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Fri, 24 Mar 2023 23:04:10 +0000 (16:04 -0700)
commit9821d8d4628e630ab56f47a8e6b878a2576e069b
tree06cbe34a046e0ec777302047d7b710b724f6f73e
parent4e0473f1060aa49621d40a113afde24818101d37
lib: cpu_rmap: Use allocator for rmap entries

Use a proper allocator for rmap entries using a naive for loop. The
allocator relies on whether an entry is NULL to be considered free.
Remove the used field of rmap which is not needed.

Also, avoid crashing the kernel if an entry is not available.

Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Eli Cohen <elic@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
include/linux/cpu_rmap.h
lib/cpu_rmap.c