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: <87jznzts6f.fsf@yhuang6-desk2.ccr.corp.intel.com>
Date: Wed, 24 Jan 2024 09:51:20 +0800
From: "Huang, Ying" <ying.huang@...el.com>
To: Gregory Price <gregory.price@...verge.com>
Cc: Gregory Price <gourry.memverge@...il.com>,  <linux-mm@...ck.org>,
  <linux-kernel@...r.kernel.org>,  <linux-doc@...r.kernel.org>,
  <linux-fsdevel@...r.kernel.org>,  <linux-api@...r.kernel.org>,
  <corbet@....net>,  <akpm@...ux-foundation.org>,  <honggyu.kim@...com>,
  <rakie.kim@...com>,  <hyeongtak.ji@...com>,  <mhocko@...nel.org>,
  <vtavarespetr@...ron.com>,  <jgroves@...ron.com>,
  <ravis.opensrc@...ron.com>,  <sthanneeru@...ron.com>,
  <emirakhur@...ron.com>,  <Hasan.Maruf@....com>,
  <seungjun.ha@...sung.com>,  <hannes@...xchg.org>,
  <dan.j.williams@...el.com>,  Srinivasulu Thanneeru
 <sthanneeru.opensrc@...ron.com>
Subject: Re: [PATCH v2 3/3] mm/mempolicy: introduce MPOL_WEIGHTED_INTERLEAVE
 for weighted interleaving

Gregory Price <gregory.price@...verge.com> writes:

> On Tue, Jan 23, 2024 at 04:35:19PM +0800, Huang, Ying wrote:
>> Gregory Price <gregory.price@...verge.com> writes:
>> 
>> > On Mon, Jan 22, 2024 at 11:54:34PM -0500, Gregory Price wrote:
>> >> > 
>> >> > Can the above code be simplified as something like below?
>> >> > 
>> >> >         resume_node = prev_node;
>> > ---         resume_weight = 0;
>> > +++         resume_weight = weights[node];
>> >> >         for (...) {
>> >> >                 ...
>> >> >         }
>> >> > 
>> >> 
>> >> I'll take another look at it, but this logic is annoying because of the
>> >> corner case:  me->il_prev can be NUMA_NO_NODE or an actual numa node.
>> >> 
>> >
>> > After a quick look, as long as no one objects to (me->il_prev) remaining
>> > NUMA_NO_NODE
>> 
>> MAX_NUMNODES-1 ?
>> 
>
> When setting a new policy, the il_prev gets set to NUMA_NO_NODE. It's

IIUC, it is set to MAX_NUMNODES-1 as below,

@@ -846,7 +858,8 @@ static long do_set_mempolicy(unsigned short mode, unsigned short flags,
 
 	old = current->mempolicy;
 	current->mempolicy = new;
-	if (new && new->mode == MPOL_INTERLEAVE)
+	if (new && (new->mode == MPOL_INTERLEAVE ||
+		    new->mode == MPOL_WEIGHTED_INTERLEAVE))
 		current->il_prev = MAX_NUMNODES-1;
 	task_unlock(current);
 	mpol_put(old);

I don't think we need to change this.

> not harmful and is just (-1), which is functionally the same as
> (MAX_NUMNODES-1) for the purpose of iterating the nodemask with
> next_node_in(). So it's fine to set (resume_node = me->il_prev)
> as discussed.
>
> I have a cleaned up function I'll push when i fix up a few other spots.
>
>> > while having a weight assigned to pol->wil.cur_weight,
>> 
>> I think that it is OK.
>> 
>> And, IIUC, pol->wil.cur_weight can be 0, as in
>> weighted_interleave_nodes(), if it's 0, it will be assigned to default
>> weight for the node.
>> 
>
> cur_weight is different than the global weights.  cur_weight tells us
> how many pages are remaining to allocate for the current node.
>
> (cur_weight = 0) can happen in two scenarios:
>   - initial setting of mempolicy (NUMA_NO_NODE w/ cur_weight=0)
>   - weighted_interleave_nodes decrements it down to 0
>
> Now that i'm looking at it - the second condition should not exist, and
> we can eliminate it. The logic in weighted_interleave_nodes is actually
> annoyingly unclear at the moment, so I'm going to re-factor it a bit to
> be more explicit.

I am OK with either way.  Just a reminder, the first condition may be
true in alloc_pages_bulk_array_weighted_interleave() and perhaps some
other places.

--
Best Regards,
Huang, Ying

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ