Port-amd64 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: dropping d=1 w=0
Le 29/02/2020 à 21:47, Andrew Doran a écrit :
> On Sat, Feb 29, 2020 at 08:43:40PM +0000, Andrew Doran wrote:
>
>> On Sat, Feb 29, 2020 at 07:47:17AM +0100, Maxime Villard wrote:
>>
>>> Le 28/02/2020 ? 19:51, is%netbsd.org@localhost a ?crit?:
>>>> On Fri, Feb 28, 2020 at 07:14:47PM +0100, Maxime Villard wrote:
>>>>> We need to eliminate the pages that have the "dirty" bit set without the
>>>>> "writable" bit set.
>>>>>
>>>>> The biggest cause of these pages is pmap_write_protect(), which drops
>>>>> PTE_W but leaves PTE_D.
>>>>
>>>> Is this a bug or intentional? - as in
>>>> "no more changes here, but need still to write what was changed earlier"
>>>
>>> Actually, I'm not so sure now. Maybe UVM will have to be fixed too.
>>
>> I think you probably just need a change in pmap_write_protect() to copy D
>> into pp_attrs if pmap_pv_tracked() gives you a non-NULL page, no? Then
>> you'd be fine to clear D on the PTE.
>
> Oops - I mean if PTE_PVLIST is set on the PTE. Because if it's not a
> managed mapping, then UVM doesn't care about the dirty bit.
Here's a first patch. With a page walker I see that the number of kernel
pages with D=1,W=0 is slightly reduced. Ok? Of course that doesn't cover
the second case for now.
Maxime
Index: pmap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/x86/pmap.c,v
retrieving revision 1.364
diff -u -r1.364 pmap.c
--- pmap.c 14 Mar 2020 05:19:50 -0000 1.364
+++ pmap.c 15 Mar 2020 14:02:36 -0000
@@ -4222,11 +4222,16 @@
pt_entry_t opte, npte;
do {
+ pt_entry_t bit_d = 0;
+
opte = *spte;
if (!pmap_valid_entry(opte)) {
goto next;
}
- npte = (opte & ~bit_rem) | bit_put;
+ if (!(opte & PTE_PVLIST)) {
+ bit_d = PTE_D;
+ }
+ npte = (opte & ~(bit_rem|bit_d)) | bit_put;
} while (pmap_pte_cas(spte, opte, npte) != opte);
if ((opte & PTE_D) != 0) {
Home |
Main Index |
Thread Index |
Old Index