All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Pavel Emelyanov <xemul@parallels.com>,
	Mel Gorman <mgorman@suse.de>,
	gnome@rvzt.net, grawoc@darkrefraction.com,
	alan@lxorguk.ukuu.org.uk, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	bugzilla-daemon@bugzilla.kernel.org
Subject: Re: [PATCH] mm: Ignore VM_SOFTDIRTY on VMA merging, v2
Date: Fri, 24 Jan 2014 01:45:05 +0400	[thread overview]
Message-ID: <20140123214505.GA1992@moon> (raw)
In-Reply-To: <20140123130235.61e2eca44d92b37936955ff1@linux-foundation.org>

On Thu, Jan 23, 2014 at 01:02:35PM -0800, Andrew Morton wrote:
> On Thu, 23 Jan 2014 19:14:45 +0400 Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> 
> > VM_SOFTDIRTY bit affects vma merge routine: if two VMAs has all
> > bits in vm_flags matched except dirty bit the kernel can't longer
> > merge them and this forces the kernel to generate new VMAs instead.
> 
> Do you intend to alter the brk() and binprm code to set VM_SOFTDIRTY?

brk() will be "dirtified" now with this merge fix.
brk
  do_brk
    out:
	...
	vma->vm_flags |= VM_SOFTDIRTY;

this will work even if vma get merged, the problem was that earlier
we tried to merge without VM_SOFTDIRTY flag. And matcher failed.

do_brk
  flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
	vma = vma_merge(mm, prev, addr, addr + len, flags,
					NULL, NULL, pgoff, NULL);
	if (vma)
		goto out;
...
out:
	...
	vma->vm_flags |= VM_SOFTDIRTY;

That said I'm not really sure now if I should alert @flags in code above.
Should I add VM_SOFTDIRTY into @flags for clarity?

Same for binprm -- the vma allocated for bprm->vma is dirtified
__bprm_mm_init
  vma->vm_flags = VM_SOFTDIRTY | VM_STACK_FLAGS | VM_STACK_INCOMPLETE_SETUP;

then setup_arg_pages calls mprotect_fixup with @vm_flags having dirty bit
set thus it'll be propagated to vma

mprotect_fixup
  ...
  vma->vm_flags = newflags;

the @newflags will have dirty bit set from caller code.

Or you mean something else which I'm missing?

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Pavel Emelyanov <xemul@parallels.com>,
	Mel Gorman <mgorman@suse.de>,
	gnome@rvzt.net, grawoc@darkrefraction.com,
	alan@lxorguk.ukuu.org.uk, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	bugzilla-daemon@bugzilla.kernel.org
Subject: Re: [PATCH] mm: Ignore VM_SOFTDIRTY on VMA merging, v2
Date: Fri, 24 Jan 2014 01:45:05 +0400	[thread overview]
Message-ID: <20140123214505.GA1992@moon> (raw)
In-Reply-To: <20140123130235.61e2eca44d92b37936955ff1@linux-foundation.org>

On Thu, Jan 23, 2014 at 01:02:35PM -0800, Andrew Morton wrote:
> On Thu, 23 Jan 2014 19:14:45 +0400 Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> 
> > VM_SOFTDIRTY bit affects vma merge routine: if two VMAs has all
> > bits in vm_flags matched except dirty bit the kernel can't longer
> > merge them and this forces the kernel to generate new VMAs instead.
> 
> Do you intend to alter the brk() and binprm code to set VM_SOFTDIRTY?

brk() will be "dirtified" now with this merge fix.
brk
  do_brk
    out:
	...
	vma->vm_flags |= VM_SOFTDIRTY;

this will work even if vma get merged, the problem was that earlier
we tried to merge without VM_SOFTDIRTY flag. And matcher failed.

do_brk
  flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
	vma = vma_merge(mm, prev, addr, addr + len, flags,
					NULL, NULL, pgoff, NULL);
	if (vma)
		goto out;
...
out:
	...
	vma->vm_flags |= VM_SOFTDIRTY;

That said I'm not really sure now if I should alert @flags in code above.
Should I add VM_SOFTDIRTY into @flags for clarity?

Same for binprm -- the vma allocated for bprm->vma is dirtified
__bprm_mm_init
  vma->vm_flags = VM_SOFTDIRTY | VM_STACK_FLAGS | VM_STACK_INCOMPLETE_SETUP;

then setup_arg_pages calls mprotect_fixup with @vm_flags having dirty bit
set thus it'll be propagated to vma

mprotect_fixup
  ...
  vma->vm_flags = newflags;

the @newflags will have dirty bit set from caller code.

Or you mean something else which I'm missing?

  reply	other threads:[~2014-01-23 21:45 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-22 19:08 [Bug 67651] Bisected: Lots of fragmented mmaps cause gimp to fail in 3.12 after exceeding vm_max_map_count Mel Gorman
2014-01-22 19:08 ` Mel Gorman
2014-01-22 19:19 ` Cyrill Gorcunov
2014-01-22 19:19   ` Cyrill Gorcunov
2014-01-22 22:33   ` Cyrill Gorcunov
2014-01-22 22:33     ` Cyrill Gorcunov
2014-01-23  9:55     ` Mel Gorman
2014-01-23  9:55       ` Mel Gorman
2014-01-23 10:36       ` Cyrill Gorcunov
2014-01-23 10:36         ` Cyrill Gorcunov
2014-01-23 12:15         ` Cyrill Gorcunov
2014-01-23 12:15           ` Cyrill Gorcunov
2014-01-23 12:55           ` Cyrill Gorcunov
2014-01-23 12:55             ` Cyrill Gorcunov
2014-01-23 15:14             ` [PATCH] mm: Ignore VM_SOFTDIRTY on VMA merging, v2 Cyrill Gorcunov
2014-01-23 15:14               ` Cyrill Gorcunov
2014-01-23 18:07               ` Pavel Emelyanov
2014-01-23 18:07                 ` Pavel Emelyanov
2014-01-23 21:02               ` Andrew Morton
2014-01-23 21:02                 ` Andrew Morton
2014-01-23 21:45                 ` Cyrill Gorcunov [this message]
2014-01-23 21:45                   ` Cyrill Gorcunov
2014-01-24 10:14               ` Mel Gorman
2014-01-24 10:14                 ` Mel Gorman
2014-01-24 11:56                 ` Cyrill Gorcunov
2014-01-24 11:56                   ` Cyrill Gorcunov
2014-01-24 13:41                   ` Mel Gorman
2014-01-24 13:41                     ` Mel Gorman
2014-01-24 14:23                     ` Cyrill Gorcunov
2014-01-24 14:23                       ` Cyrill Gorcunov
2014-01-23 10:30     ` [Bug 67651] Bisected: Lots of fragmented mmaps cause gimp to fail in 3.12 after exceeding vm_max_map_count Mel Gorman
2014-01-23 10:30       ` Mel Gorman
2022-12-07 22:00       ` Cyrill Gorcunov
2014-01-22 19:52 ` Andrew Morton
2014-01-22 19:52   ` Andrew Morton
2014-01-23  7:28   ` Mel Gorman
2014-01-23  7:28     ` Mel Gorman
2014-01-22 22:45 ` Andy Lutomirski
2014-01-22 22:45   ` Andy Lutomirski
2014-01-23  5:59   ` Cyrill Gorcunov
2014-01-23  5:59     ` Cyrill Gorcunov
2014-01-23  6:09     ` Andrew Morton
2014-01-23  6:09       ` Andrew Morton
2014-01-23  6:27       ` Cyrill Gorcunov
2014-01-23  6:27         ` Cyrill Gorcunov
2022-11-21 17:23         ` Muhammad Usama Anjum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140123214505.GA1992@moon \
    --to=gorcunov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=bugzilla-daemon@bugzilla.kernel.org \
    --cc=gnome@rvzt.net \
    --cc=grawoc@darkrefraction.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=xemul@parallels.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.