[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y9zvm4aB2B412drn@hirez.programming.kicks-ass.net>
Date: Fri, 3 Feb 2023 12:27:23 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Raghavendra K T <raghavendra.kt@....com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Ingo Molnar <mingo@...hat.com>, Mel Gorman <mgorman@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>,
David Hildenbrand <david@...hat.com>, rppt@...nel.org,
Bharata B Rao <bharata@....com>,
Disha Talreja <dishaa.talreja@....com>
Subject: Re: [PATCH V2 2/3] sched/numa: Enhance vma scanning logic
On Fri, Feb 03, 2023 at 12:15:48PM +0100, Peter Zijlstra wrote:
> > +static inline void vma_set_active_pid_bit(struct vm_area_struct *vma)
> > +{
> > + unsigned int active_pid_bit;
> > +
> > + if (vma->numab) {
> > + active_pid_bit = current->pid % BITS_PER_LONG;
> > + vma->numab->accessing_pids |= 1UL << active_pid_bit;
> > + }
> > +}
>
> Perhaps:
>
> if (vma->numab)
> __set_bit(current->pid % BITS_PER_LONG, &vma->numab->pids);
>
> ?
>
> Or maybe even:
>
> bit = current->pid % BITS_PER_LONG;
> if (vma->numab && !__test_bit(bit, &vma->numab->pids))
> __set_bit(bit, &vma->numab->pids);
>
The alternative to just taking the low n bits is to use:
hash_32(current->pid, BITS_PER_LONG)
That mixes things up a bit.
Powered by blists - more mailing lists