On Sun, 22 Feb 2026 22:26:31 -0500 Zi Yan <[email protected]> wrote:

> This prepares for upcoming page->private checks in page freeing path.
> 
> Signed-off-by: Zi Yan <[email protected]>
> Cc: Jason Xing <[email protected]>
> Cc: Yushan Zhou <[email protected]>
> Cc: "Masami Hiramatsu (Google)" <[email protected]>
> ---
>  kernel/relay.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/relay.c b/kernel/relay.c
> index 5c665b729132..d16f9966817f 100644
> --- a/kernel/relay.c
> +++ b/kernel/relay.c
> @@ -131,8 +131,10 @@ static void *relay_alloc_buf(struct rchan_buf *buf, 
> size_t *size)
>       return mem;
>  
>  depopulate:
> -     for (j = 0; j < i; j++)
> +     for (j = 0; j < i; j++) {
> +             set_page_private(buf->page_array[i], 0);

Hi Zi,

Should the index into page_array be j and not i over here?

>               __free_page(buf->page_array[j]);
> +     }
>       relay_free_page_array(buf->page_array);
>       return NULL;
>  }
> @@ -196,8 +198,10 @@ static void relay_destroy_buf(struct rchan_buf *buf)
>  
>       if (likely(buf->start)) {
>               vunmap(buf->start);
> -             for (i = 0; i < buf->page_count; i++)
> +             for (i = 0; i < buf->page_count; i++) {
> +                     set_page_private(buf->page_array[i], 0);
>                       __free_page(buf->page_array[i]);
> +             }
>               relay_free_page_array(buf->page_array);
>       }
>       *per_cpu_ptr(chan->buf, buf->cpu) = NULL;
> -- 
> 2.51.0
> 
> 

Reply via email to