Re: [PATCH v2] mm: shmem: implement POSIX_FADV_[WILL|DONT]NEED for shmem

From: Charan Teja Kalla
Date: Fri Dec 03 2021 - 06:55:54 EST


()

On 12/2/2021 9:24 PM, Matthew Wilcox wrote:
> Would this change to the documentation have prevented you from making
> this mistake?
>
> The advanced API is based around the xa_state. This is an opaque data
> structure which you declare on the stack using the XA_STATE()
> macro. This macro initialises the xa_state ready to start walking
> around the XArray. It is used as a cursor to maintain the position
> in the XArray and let you compose various operations together without
> -having to restart from the top every time.
> +having to restart from the top every time. The contents of the xa_state
> +are protected by the rcu_read_lock() or the xas_lock(). If you need to
> +drop whichever of those locks is protecting your state and tree, you must
> +call xas_pause() so that future calls do not rely on the parts of the
> +state which were left unprotected.

Yes, this looks much clear to me.

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum, a Linux Foundation Collaborative Project