[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v7 2/2] memory: Do not create circular reference with subregi
From: |
Peter Xu |
Subject: |
Re: [PATCH v7 2/2] memory: Do not create circular reference with subregion |
Date: |
Thu, 9 Jan 2025 10:55:58 -0500 |
On Thu, Jan 09, 2025 at 02:50:21PM +0900, Akihiko Odaki wrote:
> memory_region_update_container_subregions() used to call
> memory_region_ref(), which creates a reference to the owner of the
> subregion, on behalf of the owner of the container. This results in a
> circular reference if the subregion and container have the same owner.
>
> memory_region_ref() creates a reference to the owner instead of the
> memory region to match the lifetime of the owner and memory region. We
> do not need such a hack if the subregion and container have the same
> owner because the owner will be alive as long as the container is.
> Therefore, create a reference to the subregion itself instead ot its
> owner in such a case; the reference to the subregion is still necessary
> to ensure that the subregion gets finalized after the container.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
--
Peter Xu
[PATCH v7 2/2] memory: Do not create circular reference with subregion, Akihiko Odaki, 2025/01/09
- Re: [PATCH v7 2/2] memory: Do not create circular reference with subregion,
Peter Xu <=