Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1622561

Re: [RFC 2/6] mm, mempolicy: stop adjusting current->il_next in mpol_rebind_nodemask()

From Christoph Lameter <cl@linux.com>
Newsgroups linux.kernel
Subject Re: [RFC 2/6] mm, mempolicy: stop adjusting current->il_next in mpol_rebind_nodemask()
Date 2017-04-12 23:20 +0200
Message-ID <tvxQe-1uj-13@gated-at.bofh.it> (permalink)
References <tv4Ey-823-9@gated-at.bofh.it> <tv4Ey-823-17@gated-at.bofh.it> <tv7VM-1CC-13@gated-at.bofh.it> <tv9kS-2Ej-9@gated-at.bofh.it> <tvm8q-2hK-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 12 Apr 2017, Vlastimil Babka wrote:

> >> Well, interleave_nodes() will then potentially return a node outside of
> >> the allowed memory policy when its called for the first time after
> >> mpol_rebind_.. . But thenn it will find the next node within the
> >> nodemask and work correctly for the next invocations.
> >
> > Hmm, you're right. But that could be easily fixed if il_next became il_prev, so
> > we would return the result of next_node_in(il_prev) and also store it as the new
> > il_prev, right? I somehow assumed it already worked that way.

Yup that makes sense and I thought about that when I saw the problem too.

> @@ -863,6 +856,18 @@ static int lookup_node(unsigned long addr)
>  	return err;
>  }
>
> +/* Do dynamic interleaving for a process */
> +static unsigned interleave_nodes(struct mempolicy *policy, bool update_prev)

Why do you need an additional flag? Would it not be better to always
update and switch the update_prev=false case to simply use
next_node_in()?

> +{
> +	unsigned next;
> +	struct task_struct *me = current;
> +
> +	next = next_node_in(me->il_prev, policy->v.nodes);
> +	if (next < MAX_NUMNODES && update_prev)
> +		me->il_prev = next;
> +	return next;
> +}
> +
>  /* Retrieve NUMA policy */
>  static long do_get_mempolicy(int *policy, nodemask_t *nmask,
>  			     unsigned long addr, unsigned long flags)
> @@ -916,7 +921,7 @@ static long do_get_mempolicy(int *policy, nodemask_t *nmask,
>  			*policy = err;
>  		} else if (pol == current->mempolicy &&
>  				pol->mode == MPOL_INTERLEAVE) {
> -			*policy = current->il_next;
> +			*policy = interleave_nodes(current->mempolicy, false);

Here

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[RFC 2/6] mm, mempolicy: stop adjusting current->il_next in mpol_rebind_nodemask() Vlastimil Babka <vbabka@suse.cz> - 2017-04-11 16:10 +0200
  Re: [RFC 2/6] mm, mempolicy: stop adjusting current->il_next in  mpol_rebind_nodemask() Christoph Lameter <cl@linux.com> - 2017-04-11 19:40 +0200
    Re: [RFC 2/6] mm, mempolicy: stop adjusting current->il_next in  mpol_rebind_nodemask() Vlastimil Babka <vbabka@suse.cz> - 2017-04-11 21:10 +0200
      Re: [RFC 2/6] mm, mempolicy: stop adjusting current->il_next in  mpol_rebind_nodemask() Vlastimil Babka <vbabka@suse.cz> - 2017-04-12 10:50 +0200
        Re: [RFC 2/6] mm, mempolicy: stop adjusting current->il_next in  mpol_rebind_nodemask() Vlastimil Babka <vbabka@suse.cz> - 2017-04-12 23:20 +0200
        Re: [RFC 2/6] mm, mempolicy: stop adjusting current->il_next in  mpol_rebind_nodemask() Christoph Lameter <cl@linux.com> - 2017-04-12 23:20 +0200

csiph-web