lkml.org 
[lkml]   [2012]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] slab/mempolicy: always use local policy from interrupt context v3
On Wed, 30 May 2012, Andi Kleen wrote:

> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index cfb6c86..b65eb06 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -1586,9 +1586,11 @@ static unsigned interleave_nodes(struct mempolicy *policy)
> * task can change it's policy. The system default policy requires no
> * such protection.
> */
> -unsigned slab_node(struct mempolicy *policy)
> +unsigned slab_node(void)
> {
> - if (!policy || policy->flags & MPOL_F_LOCAL)
> + struct mempolicy *policy = current->mempolicy;
> +
> + if (in_interrupt() || !policy || policy->flags & MPOL_F_LOCAL)
> return numa_node_id();
>
> switch (policy->mode) {

I think the version proposed by David Mackey is more clear, it makes it
obvious that we don't want to dereference current in interrupt context
whereas that relies on short-circuiting your conditional in your approach.


\
 
 \ /
  Last update: 2012-05-31 23:01    [W:1.538 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site