From: Hanjun Guo <guohanjun@huawei.com>
To: Will Deacon <Will.Deacon@arm.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: [RFC] munmap(64k) is much slower with patch set reduce synchronous TLB invalidation on ARM64 merged
Date: Sat, 4 May 2019 19:44:59 +0800 [thread overview]
Message-ID: <3a0e9ffc-315b-079f-bc0b-3ee3dca88905@huawei.com> (raw)
Hi Will,
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:
#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?
Looking forward your insight on this.
Best regards
Hanjun
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2019-05-04 11:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-04 11:44 Hanjun Guo [this message]
2019-05-06 18:47 ` [RFC] munmap(64k) is much slower with patch set reduce synchronous TLB invalidation on ARM64 merged Will Deacon
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=3a0e9ffc-315b-079f-bc0b-3ee3dca88905@huawei.com \
--to=guohanjun@huawei.com \
--cc=Will.Deacon@arm.com \
--cc=catalin.marinas@arm.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