Re: [PATCH] mm: Define VM_(MAX|MIN)_READAHEAD via sizes.h constants

From: Nikolay Borisov
Date: Fri Dec 21 2018 - 09:06:49 EST




On 21.12.18 Ð. 15:24 Ñ., Matthew Wilcox wrote:
> On Fri, Dec 21, 2018 at 02:53:14PM +0200, Nikolay Borisov wrote:
>> All users of the aformentioned macros convert them to kbytes by
>> multplying. Instead, directly define the macros via the aptly named
>> SZ_16K/SZ_128K ones. Also remove the now redundant comments explaining
>> that VM_* are defined in kbytes it's obvious. No functional changes.
>
> Actually, all users of these constants convert them to pages!
>
>> + q->backing_dev_info->ra_pages = VM_MAX_READAHEAD / PAGE_SIZE;
>> + sb->s_bdi->ra_pages = VM_MAX_READAHEAD / PAGE_SIZE;
>> + sb->s_bdi->ra_pages = VM_MAX_READAHEAD / PAGE_SIZE;
>> + sb->s_bdi->ra_pages = VM_MAX_READAHEAD / PAGE_SIZE;
>> + sb->s_bdi->ra_pages = VM_MAX_READAHEAD / PAGE_SIZE;
>
>> -#define VM_MAX_READAHEAD 128 /* kbytes */
>> -#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */
>> +#define VM_MAX_READAHEAD SZ_128K
>> +#define VM_MIN_READAHEAD SZ_16K /* includes current page */
>
> So perhaps:
>
> #define VM_MAX_READAHEAD (SZ_128K / PAGE_SIZE)
>
> VM_MIN_READAHEAD isn't used, so just delete it?

I thought about that but didn't know if people will complain that some
times in the future we might need it.

>