Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Hanjun Guo <guohanjun@huawei.com>
Cc: "wangxiongfeng \(C\)" <wangxiongfeng2@huawei.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Linuxarm <linuxarm@huawei.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"Zhouguanghui \(OS Kernel\)" <zhouguanghui1@huawei.com>
Subject: Re: [RFC] munmap(64k) is much slower with patch set reduce synchronous TLB invalidation on ARM64 merged
Date: Mon, 6 May 2019 19:47:14 +0100	[thread overview]
Message-ID: <20190506184714.GE2875@brain-police> (raw)
In-Reply-To: <3a0e9ffc-315b-079f-bc0b-3ee3dca88905@huawei.com>

On Sat, May 04, 2019 at 07:44:59PM +0800, Hanjun Guo wrote:
> With patch set "Avoid synchronous TLB invalidation for intermediate
> page-table entries on arm64" was merged, munmap() for hugepage such as
> 2M will be much faster, but with following case, munmap(64k) will take
> much longer time than before:

I didn't find anything grepping for that subject. Could you provide a commit
ID instead, please?

> #define MEM_LEN_TEST			(0x10000UL)
> #define MEM_ADD_START			(0x8000fffef000UL)
> #define MEM1_ADD_START			(0x800000090000UL)
> 
> mem = (unsigned char *)mmap((void *)MEM_ADD_START, MEM_LEN_TEST, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> 
> mem1 = (unsigned char *)mmap((void *)MEM1_ADD_START, MEM_LEN_TEST, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> 
> munmap(mem, MEM_LEN_TEST); // will take much longer time (from 50us to 230us on A55) than before
> 
> munmap(mem1, MEM_LEN_TEST);
> 
> munmap(mem, MEM_LEN_TEST) will finally call unmap_region() in the kernel,
> and in free_pgtables() will adjust the start and end in mmu_gather, so when
> running to __flush_tlb_range(), the (end - start) will more that 1G but less
> than 2G in this case, on the other hand, (MAX_TLBI_OPS * stride) will be 2G
> as the stride is 2M.
> 
> So in the end if ((end - start) > (MAX_TLBI_OPS * stride)) will not valid,
> and will take loops to invalidate the TLB for many times which is time consuming.
> 
> Can we make the (MAX_TLBI_OPS * stride) as constant such as 4M (which is the
> value before "Avoid synchronous TLB invalidation for intermediate page-table
> entries on arm64" merged)? or a smaller value for MAX_TLBI_OPS?

Changing MAX_TLBI_OPS will hurt the common case when tearing down PMD tables
with 4k pages, so I'm hesitant to change that again.

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-05-06 18:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-04 11:44 [RFC] munmap(64k) is much slower with patch set reduce synchronous TLB invalidation on ARM64 merged Hanjun Guo
2019-05-06 18:47 ` Will Deacon [this message]
2019-05-07  3:15   ` Hanjun Guo

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=20190506184714.GE2875@brain-police \
    --to=will.deacon@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=guohanjun@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linuxarm@huawei.com \
    --cc=wangxiongfeng2@huawei.com \
    --cc=zhouguanghui1@huawei.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