Re: [Lsf-pc] [LSF/MM/BPF TOPIC] Reclamation interactions with RCU

Kent Overstreet
2024-03-04T02:05:43Z

On Mon, Mar 04, 2024 at 12:35:05AM +0000, Matthew Wilcox wrote:
> On Mon, Mar 04, 2024 at 09:45:48AM +1100, NeilBrown wrote:
> > I have in mind a more explicit statement of how much waiting is
> > acceptable.
> >
> > GFP_NOFAIL - wait indefinitely
> > GFP_KILLABLE - wait indefinitely unless fatal signal is pending.
> > GFP_RETRY - may retry but deadlock, though unlikely, is possible. So
> > don't wait indefinitely. May abort more quickly if fatal
> > signal is pending.
> > GFP_NO_RETRY - only try things once. This may sleep, but will give up
> > fairly quickly. Either deadlock is a significant
> > possibility, or alternate strategy is fairly cheap.
> > GFP_ATOMIC - don't sleep - same as current.
>
> I don't think these should be GFP flags. Rather, these should be
> context flags (and indeed, they're mutually exclusive, so this is a
> small integer to represent where we are on the spectrum). That is
> we want code to do

Why?

Context flags are for /context/, i.e. the scope where you take a lock
that's GFP_FS unsafe. These really are callsite specific - "how bad is
it if we have to deal with an allocation failure here?"