Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1138853pxa; Sat, 22 Aug 2020 12:41:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrRc52UjzeJXB66ap6uILlohU/M/8pbaubJiVcurkmIYyb/2ZkJRJlA7Lz2ntanYpX04c7 X-Received: by 2002:a17:906:840c:: with SMTP id n12mr8210575ejx.246.1598125281999; Sat, 22 Aug 2020 12:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598125281; cv=none; d=google.com; s=arc-20160816; b=NdsHbAC/ZBLoo0HL0XN7QlwB2GmgBHyYEVTKc+cG6l+CMUK3Qx7JXmVYOtNhXO3adl RRqCtI8K2fS8yoFsSGDJPNjC98+hSnc4y4w72mJtqYOH8p4RibsnHHURoWpeLX0PGJSM eCzyjUlh4A7bdXkttqSthnBQNEOn5KdfYNwH/eEAQfY49DckWC7wxyN/i7u+QaiCIysz 2s8fGUIakLDZSlFrZu8SYtQ2XZTg1ZrNvLpdjHWFt2RoUEJHUktTlY+JpgzHV/t8XUIB iu/5rTcSgot5WjrjWWajc22zr9xdzWW8ILOgt1E9rAxzrajNo5/ITf1UQuuLTXM6qTDN AljA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=D2UpM4JiRz3DSJbLEVUit3CMbJBOHMsg2oZwhaPpIVA=; b=rW1LcruD0+uhTOqXBUcuMBpKB0lXkUAk2uKyf7gcTE/afQG3kqURT5NzVk/0lPKLus hbZ5hgEk0eVlRYhVW8qX+36Jbj8ja9QFGC5bODL8Oj+u2D4yix43/7nheM/Wrq1G/vgY OSFCuoYytzngjKWCyGYTpRGPy0RtksAVQ95RjMBDDSY0NxsS3zOvM+woN/RBVjq0Ihnw SRqODAUEID2mmHv19uKQjP6Cja/lkZNxz3n6y0mM2z3Svq4OuyZSD9DVxwGKG33Unznh gxQ5U4L2KxXmDTOow3I7cr5pz/WN9bgNgkYmA4WFQiFQc+16JRpscMM9k6JWgC2RHMKH Pi6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tfz-net.20150623.gappssmtp.com header.s=20150623 header.b=mE1R29cU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f16si1490739ejt.722.2020.08.22.12.40.58; Sat, 22 Aug 2020 12:41:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@tfz-net.20150623.gappssmtp.com header.s=20150623 header.b=mE1R29cU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728710AbgHVThB (ORCPT + 99 others); Sat, 22 Aug 2020 15:37:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728699AbgHVTg4 (ORCPT ); Sat, 22 Aug 2020 15:36:56 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FD63C061575 for ; Sat, 22 Aug 2020 12:36:56 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id a65so1235882wme.5 for ; Sat, 22 Aug 2020 12:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tfz-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=D2UpM4JiRz3DSJbLEVUit3CMbJBOHMsg2oZwhaPpIVA=; b=mE1R29cUE7e5dkG7Erf7qXQPY5FC1XBoN3dQ3DNlq6pOwtQs2QA/HXJg+Dgi5aOmH0 eukcJ8ZutRhpaQncdPJv6JPb+cI8dUgxhZOl7G7h/+GRuyQAtNLkf8bbjBOFeimdSOEw OaSqA1PNnbdqb/ubLToV2eloOntz6ZLCiKy70oadVyFZ6JzY3sG06ZyzadCo2EyeY4nG 3JyI0xU5lcq7UK77Ay6zWGuRPL+JSUd8q02b2LvB8p3d4NzD1i5DxjlxVKlcNoBjBOzM VtysgUcFhUiCjFFRHWw5qkE45NrxOCH/R44dGkF6SqKuKXiIW/RNpcd0ktK642yGEniJ kzBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=D2UpM4JiRz3DSJbLEVUit3CMbJBOHMsg2oZwhaPpIVA=; b=BspZL1aKgJjRbFENHwJSpc13xBFs4bTc30iLBDwyIuy/CYqEd7D0XytV+WysPGWdXa 8UbKfv6ziG9TOcpxQaeCPrp6ahujhWgBbH+zJSNvTTc80rKZh7jG4tzMImFLXvJHa0rW 7HuGcNnDvUB2vHLIr+BlX47R9eir451N1LeT9THlb1f1/M6BFYpr/XpiqKYR7trFCf3Z ZGXoBG4kqrFqHstu13s7SK1XTo9NnYwFI1n1SNOuXDiLVBcpze6yXEYlh/v3P39o5B2V VP797UhJpiR6vBG+RaHftONQ65TN//YSW4GNJhG9wrzkekMBoumRxTPSCn/gkj9VzjcB U60Q== X-Gm-Message-State: AOAM5309WESz8iLE+/2fBbesnz9bH92Ea5Sv4du0skRARgi/y+aGAIqH QsfbD5hN41q4W1IgGANUtPe4FiSHKRh0VwHGf1DdYw== X-Received: by 2002:a7b:c15a:: with SMTP id z26mr8502959wmi.35.1598125014765; Sat, 22 Aug 2020 12:36:54 -0700 (PDT) MIME-Version: 1.0 References: <20200815182344.7469-1-kalou@tfz.net> <20200822032827.6386-1-kalou@tfz.net> <20200821205154.365e230dbf6f2b93a47443c4@linux-foundation.org> In-Reply-To: <20200821205154.365e230dbf6f2b93a47443c4@linux-foundation.org> From: Pascal Bouchareine Date: Sat, 22 Aug 2020 12:36:44 -0700 Message-ID: Subject: Re: [PATCH v2 1/2] mm: add GFP mask param to strndup_user To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Alexey Dobriyan , Al Viro Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: https://lkml.org/lkml/2018/1/6/333 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, > GFP_USER|__GFP_ACCOUNT)? Yes! I'll see clearer if I manage to wrap my head around what strndup_user should do Thanks!