From: Jarkko Sakkinen <jarkko@kernel.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: linux-sgx@vger.kernel.org,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
reinette.chatre@intel.com
Subject: Re: VMA's not getting merged
Date: Wed, 18 May 2022 03:47:32 +0300 [thread overview]
Message-ID: <YoRCJCtSGfxjwu2w@iki.fi> (raw)
In-Reply-To: <YoKb5P+VixJUn6xT@kernel.org>
On Mon, May 16, 2022 at 09:45:56PM +0300, Jarkko Sakkinen wrote:
> On Mon, May 16, 2022 at 07:13:42AM -0700, Dave Hansen wrote:
> > On 5/14/22 18:20, Jarkko Sakkinen wrote:
> > > Looks like VMA's do not get merged properly:
> > ...
> > > 7f8f0800b000-7f8f08014000 rw-s 00000000 00:05 84 /dev/sgx_enclave
> > > 7f8f08014000-7f8f08025000 rw-s 00000000 00:05 84 /dev/sgx_enclave
> > > 7f8f08025000-7f8f08046000 rw-s 00000000 00:05 84 /dev/sgx_enclave
> > > 7f8f08046000-7f8f0804a000 rw-s 00000000 00:05 84 /dev/sgx_enclave
> > > 7f8f0804a000-7f8f0804b000 rw-s 00000000 00:05 84 /dev/sgx_enclave
> > > 7f8f0804b000-7f8f0804c000 rw-s 00000000 00:05 84 /dev/sgx_enclave
> > > 7f8f0804c000-7f8f0804d000 rw-s 00000000 00:05 84 /dev/sgx_enclave
> > > 7f8f0804d000-7f8f0804e000 rw-s 00000000 00:05 84 /dev/sgx_enclave
> >
> > I remember some issue with VM_IO VMAs not getting merged, but I don't
> > remember how we fixed or addressed it.
> >
> > Seems like something we can and should fix, though.
>
> Access pattern here is series of small adjacent mmaps (brk()).
>
> During upstreaming vma_close callback was eliminated to allow VMA's getting
> merged. I'll try to trace the condition in the call path triggering this.
>
> BR, Jarkko
I wrote a small bpftrace script:
#include <linux/fs.h>
k:vma_merge
/strncmp(str(((struct vm_area_struct *)arg1)->vm_file->f_path.dentry->d_name.name), "sgx_enclave", 11) == 0/
{
@merge[tid] = true;
}
kr:vma_merge /@merge[tid] && retval > 0/
{
@merged = count();
delete(@merge[tid]);
}
kr:vma_merge /@merge[tid]/
{
@unmerged = count();
delete(@merge[tid]);
}
When running with the same payload, I get:
@merged: 0
@unmerged: 209
So it gets down to vma_merge but each time the function returns NULL.
BR, Jarkko
next prev parent reply other threads:[~2022-05-18 0:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-15 1:20 VMA's not getting merged Jarkko Sakkinen
2022-05-16 14:13 ` Dave Hansen
2022-05-16 18:45 ` Jarkko Sakkinen
2022-05-18 0:47 ` Jarkko Sakkinen [this message]
2022-06-06 7:21 ` Jarkko Sakkinen
2022-06-06 11:40 ` Jarkko Sakkinen
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=YoRCJCtSGfxjwu2w@iki.fi \
--to=jarkko@kernel.org \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=linux-sgx@vger.kernel.org \
--cc=reinette.chatre@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox