On Tue, Aug 10, 2021 at 06:01:16PM +0200, Vlastimil Babka wrote:
Actually looking at the git version, which has also this:
static __always_inline void update_lru_size(struct lruvec *lruvec,
enum lru_list lru, enum zone_type zid,
- int nr_pages)
+ long nr_pages)
{
Why now and here? Some of the functions called from update_lru_size()
still take int so this looks arbitrary?
I'm still a little freaked out about the lack of warning for:
void f(long n);
void g(unsigned int n) { f(-n); }
so I've decided that the count of pages in a folio is always of type
long. The actual number is positive, and currently it's between 1 and
1024 (inclusive on both bounds), so it's always going to be
representable in an int. Narrowing it doesn't cause a bug, so we don't
need to change nr_pages anywhere, but it does no harm to make functions
take a long instead of an int (it may even cause slightly better code
generation, based on the sample of functions I've looked at).
Maybe changing update_lru_size() in this patch is wrong. I can drop it
if you like.