From: <zhouxianrong@huawei.com>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
rientjes@google.com, hannes@cmpxchg.org,
chris@chris-wilson.co.uk, vdavydov.dev@gmail.com,
mgorman@techsingularity.net, joe@perches.com,
shawn.lin@rock-chips.com, iamjoonsoo.kim@lge.com,
kuleshovmail@gmail.com, zhouxianrong@huawei.com,
zhouxiyu@huawei.com, zhangshiming5@huawei.com,
won.ho.park@huawei.com, tuxiaobing@huawei.com
Subject: [PATCH vmalloc] reduce purge_lock range and hold time of
Date: Sat, 15 Oct 2016 22:12:48 +0800 [thread overview]
Message-ID: <1476540769-31893-1-git-send-email-zhouxianrong@huawei.com> (raw)
From: z00281421 <z00281421@notesmail.huawei.com>
i think no need to place __free_vmap_area loop in purge_lock;
_free_vmap_area could be non-atomic operations with flushing tlb
but must be done after flush tlb. and the whole__free_vmap_area loops
also could be non-atomic operations. if so we could improve realtime
because the loop times sometimes is larg and spend a few time.
Signed-off-by: z00281421 <z00281421@notesmail.huawei.com>
---
mm/vmalloc.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 91f44e7..9d9154d 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -661,13 +661,23 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
if (nr || force_flush)
flush_tlb_kernel_range(*start, *end);
+ spin_unlock(&purge_lock);
+
if (nr) {
+ /* the batch count should not be too small
+ ** because if vmalloc space is few free is first than alloc.
+ */
+ unsigned char batch = -1;
spin_lock(&vmap_area_lock);
- llist_for_each_entry_safe(va, n_va, valist, purge_list)
+ llist_for_each_entry_safe(va, n_va, valist, purge_list) {
__free_vmap_area(va);
+ if (!batch--) {
+ spin_unlock(&vmap_area_lock);
+ spin_lock(&vmap_area_lock);
+ }
+ }
spin_unlock(&vmap_area_lock);
}
- spin_unlock(&purge_lock);
}
/*
--
1.7.9.5
--
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>
next reply other threads:[~2016-10-15 14:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-15 14:12 zhouxianrong [this message]
2016-10-15 16:55 ` [PATCH vmalloc] reduce purge_lock range and hold time of Christoph Hellwig
2016-10-18 2:55 ` zhouxianrong
2016-10-18 2:25 ` [PATCH vmalloc] reduce purge_lock range and hold time of vmap_area_lock zhouxianrong
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=1476540769-31893-1-git-send-email-zhouxianrong@huawei.com \
--to=zhouxianrong@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=chris@chris-wilson.co.uk \
--cc=hannes@cmpxchg.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=joe@perches.com \
--cc=kuleshovmail@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=rientjes@google.com \
--cc=shawn.lin@rock-chips.com \
--cc=tuxiaobing@huawei.com \
--cc=vdavydov.dev@gmail.com \
--cc=won.ho.park@huawei.com \
--cc=zhangshiming5@huawei.com \
--cc=zhouxiyu@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;
as well as URLs for NNTP newsgroup(s).