Re: [PATCH 1/4] selftests/mm/uffd: Refactor non-composite global vars into struct

From: Brendan Jackman
Date: Fri May 02 2025 - 08:16:43 EST


On Thu May 1, 2025 at 4:38 PM UTC, Ujwal Kundur wrote:
> + * count is placed in the page after pthread_mutex_t naturally aligned
> + * to avoid non alignment faults on non-x86 archs.
> + */
> +volatile unsigned long long *area_count(
> + char *area, unsigned long nr,
> + uffd_global_test_opts_t *gopts)
> +{
> + return (volatile unsigned long long *)
> + ((unsigned long) (area + nr * gopts->page_size +
> + sizeof(pthread_mutex_t) +
> + sizeof(unsigned long long) - 1) &
> + ~(unsigned long)(sizeof(unsigned long long) - 1));

Stray space after the minus there

> -static void retry_copy_page(int ufd, struct uffdio_copy *uffdio_copy,
> +static void retry_copy_page(uffd_global_test_opts_t *gopts, struct uffdio_copy *uffdio_copy,
> unsigned long offset)
> {
> - uffd_test_ops->alias_mapping(&uffdio_copy->dst,
> + uffd_test_ops->alias_mapping(gopts,
> + &uffdio_copy->dst,

Little bit of indentation mess here

I don't understand this code but since I was hurt by these global
variables I had a look over the diff anyway, it LGTM (aside from the
formatting nits), thanks.

Reviewed-by: Brendan Jackman <jackmanb@xxxxxxxxxx>