lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y9zxkGf50bqkucum@hirez.programming.kicks-ass.net>
Date:   Fri, 3 Feb 2023 12:35:44 +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 3/3] sched/numa: Reset the accessing PID information
 periodically

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ