linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Raghavendra K T <raghavendra.kt@amd.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Ingo Molnar <mingo@redhat.com>, Mel Gorman <mgorman@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>,
	rppt@kernel.org, Bharata B Rao <bharata@amd.com>,
	Disha Talreja <dishaa.talreja@amd.com>
Subject: Re: [PATCH V2 3/3] sched/numa: Reset the accessing PID information periodically
Date: Sun, 5 Feb 2023 00:02:07 +0530	[thread overview]
Message-ID: <45360170-f132-3204-1e99-ed78c73641c4@amd.com> (raw)
In-Reply-To: <Y9zxkGf50bqkucum@hirez.programming.kicks-ass.net>

On 2/3/2023 5:05 PM, Peter Zijlstra wrote:
> On Wed, Feb 01, 2023 at 01:32:22PM +0530, Raghavendra K T wrote:
> 
>> 2) Maintain duplicate list of accessing PIDs to keep track of history of access. and switch/reset. use OR operation during iteration
>>
>>   Two lists of PIDs maintained. At regular interval old list is reset and we make current list as old list
>> At any point of time tracking of PIDs accessing VMA is determined by ORing list1 and list2
>>
>> accessing_pids_list1 <-  current list
>> accessing_pids_list2 <-  old list
> 
> ( I'm not sure why you think this part of the email doesn't need to be
>    nicely wrapped at 76 chars.. )
> 

Sorry.. copy pasted from my "idea" notes then word wrap fooled me..

> This seems simple enough to me and can be trivially extended to N if
> needed.
>  > The typical implementation would looks something like:
> 
> 	unsigned long pids[N];
> 	unsigned int pid_idx;
> 
> set:
> 	unsigned long *pids = numab->pids + pid_idx;
> 	if (!__test_bit(bit, pids))
> 		__set_bit(bit, pids);
> 
> test:
> 	unsigned long pids = 0;
> 	for (int i = 0; i < N; i++)
> 		pids |= numab->pids[i];
> 	return __test_bit(bit, &pids);
> 
> rotate:
> 	idx = READ_ONCE(numab->pid_idx);
> 	WRITE_ONCE(numab->pid_idx, (idx + 1) % N);
> 	numab->pids[idx] = 0;
> 
> Note the actual rotate can be simplified to ^1 for N:=2.

Thanks good idea. This will be very helpful when we want to
differentiate accessing PIDs in more granular way. Perhaps we can go
with N=2 and stick to below simplification of your code above?

something like:

unsigned long pids[2]

// Assume pids[1] has latest detail always
set:
if (!__test_bit(bit, pids[1])
	__set_bit(bit, pids[1])

test:
unsigned long pids = pids[0] | pids[1];
return __test_bit(bit, &pids);

rotate:
pids[0] = pids[1];
pids[1] = 0;


      reply	other threads:[~2023-02-04 18:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01  8:02 [PATCH V2 0/3] sched/numa: Enhance vma scanning Raghavendra K T
2023-02-01  8:02 ` [PATCH V2 1/3] sched/numa: Apply the scan delay to every vma instead of tasks Raghavendra K T
2023-02-03 10:24   ` Peter Zijlstra
2023-02-04 17:19     ` Raghavendra K T
2023-02-01  8:02 ` [PATCH V2 2/3] sched/numa: Enhance vma scanning logic Raghavendra K T
2023-02-03 11:15   ` Peter Zijlstra
2023-02-03 11:27     ` Peter Zijlstra
2023-02-04 18:18       ` Raghavendra K T
2023-02-04 18:14     ` Raghavendra K T
2023-02-07  6:41       ` Raghavendra K T
2023-02-27  6:40         ` Raghavendra K T
2023-02-27 10:06           ` Peter Zijlstra
2023-02-27 10:12             ` Raghavendra K T
2023-02-28  4:59       ` Raghavendra K T
2023-02-01  8:02 ` [PATCH V2 3/3] sched/numa: Reset the accessing PID information periodically Raghavendra K T
2023-02-03 11:35   ` Peter Zijlstra
2023-02-04 18:32     ` Raghavendra K T [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45360170-f132-3204-1e99-ed78c73641c4@amd.com \
    --to=raghavendra.kt@amd.com \
    --cc=akpm@linux-foundation.org \
    --cc=bharata@amd.com \
    --cc=david@redhat.com \
    --cc=dishaa.talreja@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rppt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox