[lkml]   [2020]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v2 1/2] mm: add GFP mask param to strndup_user
Thanks for taking a look!

On Fri, Aug 21, 2020 at 8:51 PM Andrew Morton <> wrote:
> Why change all existing callsites so that one callsite can pass in a
> different gfp_t?

My initial thought was to change strndup_user to use
GFP_KERNEL_ACCOUNT (or GFP_USER | __GFP_ACCOUNT ?) unconditionally.

(Would that work? that would be a simpler change for sure)

In the case it was not wanted, I assumed a good proportion of callers
might do the same on a case-by-case basis (esp. with regards to
enabling accounting).

> Also...
> why does strndup_user() use GFP_USER? Nobody will be mapping the
> resulting strings into user pagetables (will they?). This was done by
> Al's 6c2c97a24f096e32, which doesn't have a changelog :(

FWIW, I believe related to this:

It's a bit over my head (is GFP_USER cheaper?) if strndup_user needs
to follow memdup_user

> In [patch 2/2],
> + desc = strndup_user(user_desc, SK_MAX_DESC_SIZE, GFP_KERNEL_ACCOUNT);
> if GFP_USER is legit then shouldn't this be GFP_USER_ACCOUNT (ie,

Yes! I'll see clearer if I manage to wrap my head around what
strndup_user should do

 \ /
  Last update: 2022-09-17 16:08    [W:0.113 / U:1.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site