[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231204115712.41114-1-aliceryhl@google.com>
Date: Mon, 4 Dec 2023 11:57:11 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: cmllamas@...gle.com
Cc: arve@...roid.com, brauner@...nel.org, gregkh@...uxfoundation.org,
joel@...lfernandes.org, kernel-team@...roid.com,
linux-kernel@...r.kernel.org, maco@...roid.com, surenb@...gle.com,
tkjos@...roid.com, Alice Ryhl <aliceryhl@...gle.com>
Subject: Re: [PATCH v2 19/28] binder: perform page installation outside of locks
> Split out the insertion of pages to be outside of the alloc->mutex in a
> separate binder_install_buffer_pages() routine. Since this is no longer
> serialized, we must look at the full range of pages used by the buffers.
> The installation is protected with mmap_sem in write mode since multiple
> tasks might race to install the same page.
>
> Besides avoiding unnecessary nested locking this helps in preparation of
> switching the alloc->mutex into a spinlock_t in subsequent patches.
>
> Signed-off-by: Carlos Llamas <cmllamas@...gle.com>
Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
> +static inline struct page *
> +binder_get_installed_page(struct binder_lru_page *lru_page)
> +{
> + /* Pairs with release in binder_set_installed_page() */
> + return smp_load_acquire(&lru_page->page_ptr);
> +}
Technically some of the uses of this method do not actually need to be
atomic (because they never race with `binder_set_installed_page`), but I
don't mind using it anyway.
Alice
Powered by blists - more mailing lists