On Sat, Jul 20, 2024 at 11:25:28PM +0900, Minwoo Jo wrote: > This hitshield technique was devised based on the observation that MGLRU > does not consider the state of the folio when performing eviction. > > The assumption is that if a folio that has been updated 1-3 times and not > frequently updated accumulates generations until it is evicted, it is > likely to have a low probability of being referenced in the future. Hi Minwoo. This is interesting work. Thank you for sending it out. I do not consider myself qualified to comment on your assumption, but I have some feedback on your implementation. > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > index a199c48bc462..053d5620574e 100644 > --- a/include/linux/mm_types.h > +++ b/include/linux/mm_types.h > @@ -189,6 +189,12 @@ struct page { > void *virtual; /* Kernel virtual address (NULL if > not kmapped, ie. highmem) */ > #endif /* WANT_PAGE_VIRTUAL */ > + unsigned char hit_shield; /* > + * The hit_shield variable I added to the page > + * This variable is responsible for counting > + * the number of times this > + * page's generation has been updated. > + */ We don't really have space in struct page for this kind of thing, unfortunately. There are a _few_ bits available in page->flags on 64-bit, but even that is a bit tenuous.