* [PATCH] MIPS: Flush huge TLB
@ 2011-11-18 13:15 Hillf Danton
2011-11-18 14:46 ` Ralf Baechle
2011-11-21 10:48 ` Sergei Shtylyov
0 siblings, 2 replies; 4+ messages in thread
From: Hillf Danton @ 2011-11-18 13:15 UTC (permalink / raw)
To: Ralf Baechle; +Cc: David Daney, Jayachandran C., linux-mips
When flushing TLB, if @vma is backed by huge page, we could flush huge TLB,
due to that huge page is defined to be far from normal page.
Signed-off-by: Hillf Danton <dhillf@gmail.com>
---
--- a/arch/mips/mm/tlb-r4k.c Mon May 30 21:17:04 2011
+++ b/arch/mips/mm/tlb-r4k.c Fri Nov 18 21:13:13 2011
@@ -120,22 +120,30 @@ void local_flush_tlb_range(struct vm_are
if (cpu_context(cpu, mm) != 0) {
unsigned long size, flags;
+ int huge = is_vm_hugetlb_page(vma);
ENTER_CRITICAL(flags);
- size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
- size = (size + 1) >> 1;
+ if (huge) {
+ start = round_down(start, HPAGE_SIZE);
+ end = round_up(end, HPAGE_SIZE);
+ size = (end - start) >> HPAGE_SHIFT;
+ } else {
+ start = round_down(start, PAGE_SIZE << 1);
+ end = round_up(end, PAGE_SIZE << 1);
+ size = (end - start) >> (PAGE_SHIFT + 1);
+ }
if (size <= current_cpu_data.tlbsize/2) {
int oldpid = read_c0_entryhi();
int newpid = cpu_asid(cpu, mm);
- start &= (PAGE_MASK << 1);
- end += ((PAGE_SIZE << 1) - 1);
- end &= (PAGE_MASK << 1);
while (start < end) {
int idx;
write_c0_entryhi(start | newpid);
- start += (PAGE_SIZE << 1);
+ if (huge)
+ start += HPAGE_SIZE;
+ else
+ start += (PAGE_SIZE << 1);
mtc0_tlbw_hazard();
tlb_probe();
tlb_probe_hazard();
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] MIPS: Flush huge TLB
2011-11-18 13:15 [PATCH] MIPS: Flush huge TLB Hillf Danton
@ 2011-11-18 14:46 ` Ralf Baechle
2011-11-18 14:55 ` Hillf Danton
2011-11-21 10:48 ` Sergei Shtylyov
1 sibling, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2011-11-18 14:46 UTC (permalink / raw)
To: Hillf Danton; +Cc: David Daney, Jayachandran C., linux-mips
On Fri, Nov 18, 2011 at 09:15:39PM +0800, Hillf Danton wrote:
> When flushing TLB, if @vma is backed by huge page, we could flush huge TLB,
> due to that huge page is defined to be far from normal page.
>
> Signed-off-by: Hillf Danton <dhillf@gmail.com>
It seems this patch is identical to
https://patchwork.linux-mips.org/patch/2825/ which I've already applied?
Ralf
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] MIPS: Flush huge TLB
2011-11-18 14:46 ` Ralf Baechle
@ 2011-11-18 14:55 ` Hillf Danton
0 siblings, 0 replies; 4+ messages in thread
From: Hillf Danton @ 2011-11-18 14:55 UTC (permalink / raw)
To: Ralf Baechle; +Cc: David Daney, Jayachandran C., linux-mips
On Fri, Nov 18, 2011 at 10:46 PM, Ralf Baechle <ralf@linux-mips.org> wrote:
> On Fri, Nov 18, 2011 at 09:15:39PM +0800, Hillf Danton wrote:
>
>> When flushing TLB, if @vma is backed by huge page, we could flush huge TLB,
>> due to that huge page is defined to be far from normal page.
>>
>> Signed-off-by: Hillf Danton <dhillf@gmail.com>
>
> It seems this patch is identical to
> https://patchwork.linux-mips.org/patch/2825/ which I've already applied?
>
Maybe you forget the following message:)
btw, I want to change
+ size = (end - start) >> HPAGE_SHIFT;
to
+ size = (end - start) / HPAGE_SIZE;
if it is not too late.
Best regards
Hillf
On Wed, Nov 16, 2011 at 10:52 PM, Ralf Baechle <ralf@linux-mips.org> wrote:
> On Fri, Oct 14, 2011 at 09:09:37PM +0800, Hillf Danton wrote:
>
>> Subject: Flush huge TLB
>> From: Hillf Danton <dhillf@gmail.com>
>>
>> When flushing TLB, if @vma is backed by huge page, we could flush huge TLB,
>> due to that huge page is defined to be far from normal page.
>>
>> Signed-off-by: Hillf Danton <dhillf@gmail.com>
>> Acked-by: David Daney <david.daney@cavium.com>
>
> I assume this 2nd version was actually meant to be applied, not just for RFC
> so I've queued it for 3.3. But you better remove that RFC from subject and
> start a fresh mail thread when posting a patch to avoid confusion!
>
> Thanks,
>
> Ralf
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] MIPS: Flush huge TLB
2011-11-18 13:15 [PATCH] MIPS: Flush huge TLB Hillf Danton
2011-11-18 14:46 ` Ralf Baechle
@ 2011-11-21 10:48 ` Sergei Shtylyov
1 sibling, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2011-11-21 10:48 UTC (permalink / raw)
To: Hillf Danton; +Cc: Ralf Baechle, David Daney, Jayachandran C., linux-mips
Hello.
On 18-11-2011 17:15, Hillf Danton wrote:
> When flushing TLB, if @vma is backed by huge page, we could flush huge TLB,
> due to that huge page is defined to be far from normal page.
> Signed-off-by: Hillf Danton<dhillf@gmail.com>
> ---
> --- a/arch/mips/mm/tlb-r4k.c Mon May 30 21:17:04 2011
> +++ b/arch/mips/mm/tlb-r4k.c Fri Nov 18 21:13:13 2011
> @@ -120,22 +120,30 @@ void local_flush_tlb_range(struct vm_are
[...]
> write_c0_entryhi(start | newpid);
> - start += (PAGE_SIZE<< 1);
> + if (huge)
> + start += HPAGE_SIZE;
> + else
> + start += (PAGE_SIZE << 1);
Parens not needed.
WBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-11-21 10:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-18 13:15 [PATCH] MIPS: Flush huge TLB Hillf Danton
2011-11-18 14:46 ` Ralf Baechle
2011-11-18 14:55 ` Hillf Danton
2011-11-21 10:48 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox