From: "Emilio G. Cota" <cota@braap.org>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org, Richard Henderson <richard.henderson@linaro.org>
Subject: Re: [Qemu-devel] [RFC v2 5/5] cputlb: dynamically resize TLBs based on use rate
Date: Tue, 9 Oct 2018 12:03:25 -0400 [thread overview]
Message-ID: <20181009160325.GB7480@flamenco> (raw)
In-Reply-To: <87d0sjmaqq.fsf@linaro.org>
On Tue, Oct 09, 2018 at 15:54:21 +0100, Alex Bennée wrote:
> Emilio G. Cota <cota@braap.org> writes:
> > + if (new_size == old_size) {
> > + return;
> > + }
> > +
> > + g_free(env->tlb_table[mmu_idx]);
> > + g_free(env->iotlb[mmu_idx]);
> > +
> > + /* desc->n_used_entries is cleared by the caller */
> > + desc->n_flushes_low_rate = 0;
> > + env->tlb_mask[mmu_idx] = (new_size - 1) << CPU_TLB_ENTRY_BITS;
> > + env->tlb_table[mmu_idx] = g_new(CPUTLBEntry, new_size);
> > + env->iotlb[mmu_idx] = g_new0(CPUIOTLBEntry, new_size);
For the iotlb we can use g_new, right?
iotlb[foo][bar] is only checked after having checked tlb_table[foo][bar].
Otherwise tlb_flush would also flush the iotlb.
> I guess the allocation is a big enough stall there is no point either
> pre-allocating or using RCU to clean-up the old data?
I tried this. Turns out not to make a difference, because (1) we only
resize on flushes, which do not happen that often, and (2) we
size up aggressively, but the shrink rate is more conservative. So
in the end, it's a drop in the ocean. For instance, bootup+shutdown
requires 100 calls to g_new+g_free -- at ~300 cycles each, that's
about 30us out of ~8s of execution time.
> Given this is a new behaviour it would be nice to expose the occupancy
> of the TLBs in "info jit" much like we do for TBs.
The occupancy changes *very* quickly, so by the time the report is out,
the info is stale. So I'm not sure that's very useful.
The TLB size changes less often, but reporting on it is not obvious,
since we have NB_MMU_MODES sizes per CPU. Say we have 20 CPUs, what should
we report? A table with 20 * NB_MMU_MODES cells? I dunno.
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Thanks!
Emilio
next prev parent reply other threads:[~2018-10-09 16:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-08 23:27 [Qemu-devel] [RFC v2 0/5] Dynamic TLB sizing Emilio G. Cota
2018-10-08 23:27 ` [Qemu-devel] [RFC v2 1/5] tcg: Add tlb_index and tlb_entry helpers Emilio G. Cota
2018-10-09 14:43 ` Alex Bennée
2018-10-08 23:27 ` [Qemu-devel] [RFC v2 2/5] (XXX) cputlb: introduce indirection for TLB size Emilio G. Cota
2018-10-08 23:27 ` [Qemu-devel] [RFC v2 3/5] cputlb: do not evict empty entries to the vtlb Emilio G. Cota
2018-10-09 14:45 ` Alex Bennée
2018-10-09 14:49 ` Richard Henderson
2018-10-08 23:27 ` [Qemu-devel] [RFC v2 4/5] cputlb: track TLB use rate Emilio G. Cota
2018-10-09 14:47 ` Alex Bennée
2018-10-08 23:27 ` [Qemu-devel] [RFC v2 5/5] cputlb: dynamically resize TLBs based on " Emilio G. Cota
2018-10-09 14:54 ` Alex Bennée
2018-10-09 16:03 ` Emilio G. Cota [this message]
2018-10-09 16:34 ` Alex Bennée
2018-10-09 12:34 ` [Qemu-devel] [RFC v2 0/5] Dynamic TLB sizing Alex Bennée
2018-10-09 14:38 ` Emilio G. Cota
2018-10-09 14:45 ` Alex Bennée
2018-10-09 15:19 ` Emilio G. Cota
2018-10-09 15:46 ` Alex Bennée
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=20181009160325.GB7480@flamenco \
--to=cota@braap.org \
--cc=alex.bennee@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).