Hi Janusz,
...
> @@ -153,8 +153,12 @@ int shmem_sg_alloc_table(struct drm_i915_private *i915,
> struct sg_table *st,
> }
> } while (1);
>
Perhaps we could add here:
max_pages = max_segment >> PAGE_SHIFT;
/* Just to be paranoic, but not necessary */
if (!max_pages)
max_pages = 1;
> - nr_pages = min_t(unsigned long,
> - folio_nr_pages(folio), page_count - i);
> + nr_pages = min_array(((unsigned long[]) {
> + folio_nr_pages(folio),
> + page_count - i,
> + max_segment / PAGE_SIZE,
max_segment >> PAGE_SHIFT ?
For clarity this can be written as
nr_pages = min_t(unsigned long,
folio_nr_pages(folio), page_count - i);
nr_pages = min_t(unsigned long, nr_pages, max_pages);
But these are nitpicks, it's then up to you to choose the style.
Reviewed-by: Andi Shyti <[email protected]>
Thanks,
Andi
> + }), 3);
> +