All of lore.kernel.org
 help / color / mirror / Atom feed
* mempolicy ref-counting question
@ 2015-04-20 22:02 Rasmus Villemoes
  2015-04-21 14:41 ` Oleg Nesterov
  0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Villemoes @ 2015-04-20 22:02 UTC (permalink / raw)
  To: linux-mm; +Cc: Oleg Nesterov, Andrew Morton

I'm trying to understand why "git grep mpol_get" doesn't give more hits
than it does. Two of the users (kernel/sched/debug.c and
fs/proc/task_mmu.c) seem to only hold the extra reference while writing
to a seq_file. That leaves just three actual users.

In particular, I'm wondering why __split_vma (and copy_vma) use
vma_dup_policy instead of simply getting an extra reference on the
old. I see there's some cpuset_being_rebound dance in mpol_dup, but I
don't understand why that's needed: In __split_vma, we're holding
mmap_sem, so either update_tasks_nodemask has already visited this mm
via mpol_rebind_mm (which also takes the mmap_sem), so the old vma is
already rebound, or the mpol_rebind_mm call will come later and rebind
the mempolicy of both the old and new vma - why would it matter that the
new vma's policy is rebound immediately?

I'd appreciate it if someone could enlighten me (I'm probably
missing something obvious).

Rasmus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mempolicy ref-counting question
  2015-04-20 22:02 mempolicy ref-counting question Rasmus Villemoes
@ 2015-04-21 14:41 ` Oleg Nesterov
  0 siblings, 0 replies; 2+ messages in thread
From: Oleg Nesterov @ 2015-04-21 14:41 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: linux-mm, Andrew Morton, Naoya Horiguchi, Mel Gorman, KOSAKI Motohiro

I can't answer, so let me add cc's. I never understood mempolicy.c and
I forgot everything I learned when I added vma_dup_policy ;) and that
patch didn't change this logic as you can see.

All I can say is that it _seems_ to me you are right, split_vma() could
use mpol_get()...

At least mbind_range() lools suboptimal. split_vma() creates a copy, and
right after that vma_replace_policy() does another mpol_dup().

On 04/21, Rasmus Villemoes wrote:
>
> I'm trying to understand why "git grep mpol_get" doesn't give more hits
> than it does. Two of the users (kernel/sched/debug.c and
> fs/proc/task_mmu.c) seem to only hold the extra reference while writing
> to a seq_file. That leaves just three actual users.
>
> In particular, I'm wondering why __split_vma (and copy_vma) use
> vma_dup_policy instead of simply getting an extra reference on the
> old. I see there's some cpuset_being_rebound dance in mpol_dup, but I
> don't understand why that's needed: In __split_vma, we're holding
> mmap_sem, so either update_tasks_nodemask has already visited this mm
> via mpol_rebind_mm (which also takes the mmap_sem), so the old vma is
> already rebound, or the mpol_rebind_mm call will come later and rebind
> the mempolicy of both the old and new vma - why would it matter that the
> new vma's policy is rebound immediately?
>
> I'd appreciate it if someone could enlighten me (I'm probably
> missing something obvious).
>
> Rasmus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-21 14:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-20 22:02 mempolicy ref-counting question Rasmus Villemoes
2015-04-21 14:41 ` Oleg Nesterov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.