linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Raghavendra K T <raghavendra.kt@amd.com>
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: Fri, 3 Feb 2023 12:35:44 +0100	[thread overview]
Message-ID: <Y9zxkGf50bqkucum@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <b0f273113fedffb02f9b1358c88813ff355a81d6.1675159422.git.raghavendra.kt@amd.com>

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.. )

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.


  reply	other threads:[~2023-02-03 11:35 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 [this message]
2023-02-04 18:32     ` Raghavendra K T

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=Y9zxkGf50bqkucum@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --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=raghavendra.kt@amd.com \
    --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