]> git.baikalelectronics.ru Git - kernel.git/commit
cxl/region: Recycle region ids
authorDan Williams <dan.j.williams@intel.com>
Fri, 4 Nov 2022 00:31:00 +0000 (17:31 -0700)
committerDan Williams <dan.j.williams@intel.com>
Fri, 4 Nov 2022 23:03:43 +0000 (16:03 -0700)
commitaf95aa2f39307b7dc1a9e972c4127dc27aa7190c
treecc1d28f74278adbc2279efa2a926194f16b6f0f4
parent97d379b9aad472767b81a97a3783abd8a2eec6b4
cxl/region: Recycle region ids

At region creation time the next region-id is atomically cached so that
there is predictability of region device names. If that region is
destroyed and then a new one is created the region id increments. That
ends up looking like a memory leak, or is otherwise surprising that
identifiers roll forward even after destroying all previously created
regions.

Try to reuse rather than free old region ids at region release time.

While this fixes a cosmetic issue, the needlessly advancing memory
region-id gives the appearance of a memory leak, hence the "Fixes" tag,
but no "Cc: stable" tag.

Cc: Ben Widawsky <bwidawsk@kernel.org>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fixes: 3ddc7d0170cc ("cxl/region: Add region creation support")
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Link: https://lore.kernel.org/r/166752186062.947915.13200195701224993317.stgit@dwillia2-xfh.jf.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/core/region.c