]> 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)
commit8d624312a96e4af2f6bb4dc2411161564f3f94a1
treecc1d28f74278adbc2279efa2a926194f16b6f0f4
parent4dda9f36d64d0830d7c5108e9a48d52ef904ffdd
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: 25b4cc9195c0 ("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