Re: [PATCH] mm/vmscan: respect cpuset policy during page demotion
From: Michal Hocko
Date: Thu Oct 27 2022 - 03:11:00 EST
On Thu 27-10-22 14:47:22, Huang, Ying wrote:
> Michal Hocko <mhocko@xxxxxxxx> writes:
[...]
> > I can imagine workloads which wouldn't like to get their memory demoted
> > for some reason but wouldn't it be more practical to tell that
> > explicitly (e.g. via prctl) rather than configuring cpusets/memory
> > policies explicitly?
>
> If my understanding were correct, prctl() configures the process or
> thread.
Not necessarily. There are properties which are per adddress space like
PR_[GS]ET_THP_DISABLE. This could be very similar.
> How can we get process/thread configuration at demotion time?
As already pointed out in previous emails. You could hook into
folio_check_references path, more specifically folio_referenced_one
where you have all that you need already - all vmas mapping the page and
then it is trivial to get the corresponding vm_mm. If at least one of
them has the flag set then the demotion is not allowed (essentially the
same model as VM_LOCKED).
--
Michal Hocko
SUSE Labs