On Wed, Sep 25, 2024 at 3:28 PM Huang, Ying <ying.huang@xxxxxxxxx> wrote: > > Barry Song <21cnbao@xxxxxxxxx> writes: > > [snip] > > > I am perfectly fine with the approach, in the first loop, if we find all entries > > don't need CONTINUED, we can run the 2nd loop even for usage==1 > > and nr > 1. this is almost always true for a real product where anon folios > > are unlikely to be fork-shared by so many processes. > > One possible use case is ksm. Where the map count could be large. Sorry, I overlooked the KSM case, but it seems this doesn't significantly change the overall direction. :-) Since we can fall back to swap_duplicate() and handle each entry one by one after the first loopback returns -ENOMEM, KSM isn't a concern either. > > -- > Best Regards, > Huang, Ying Thanks Barry