Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp732740pxb; Tue, 2 Feb 2021 17:02:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLpa6N93ex+nbxuYTgk7rxfCbk4ShIYdmZA6wJVgX6/e45ejkJeD0wwpOr04gzuvrxfJId X-Received: by 2002:a50:a6ce:: with SMTP id f14mr677546edc.346.1612314137746; Tue, 02 Feb 2021 17:02:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612314137; cv=none; d=google.com; s=arc-20160816; b=XGbc5ea0iVSExCgSapsK7JGQhkNxveskjWBKYBjike1QIBNiX9HfhNPKVom7nv1LE9 4SkiSKcv5Zfo2hxJn4k83TpGf8CboIVTeLTLHF1qshF8SWmOoILWHfE1OZi/8RVbledY doRzEBKxRsSFu6S2xWYB5wNUx8v5b0eNObmHn2JpB2Jfq5CLe59XIErm/ZUylbPf8FjJ uBfrSclssthipeE5VXGYJLwCHc24GjZopVZGIaUteuANAt0EEAaGN7ZSFt2TW+jRy8aF uKe6igEKFvVpNNV6HUzNFegAgaErAr53gUQ20lmLRjnDUOBZxIISJPVMpPNZAsKwkaMO /wqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=/gSLnZEPcAuV/awfY6UzZKwpDjyBokFy8hWOpAWUFI8=; b=Xotp4uyhqji4yGHT5AHe+wgBCBo62frndXOL8TLcOXbcqJu1l6dOCbtgOLU/Rx0BDJ nJn/j0HE4KsgBqfC34hwRP5+miWvt0Z7PhCSmKLms5vjhtG+4rOJZS2t07oeBaIwfiYl 9wtyoJuHHiXp3nXSLTYEyFiWWVdxSqUjeJyZhqlmlIO3+DG+oFt+aT3+PSSLWqILnIt9 3aSkEutUTyxANRB+hW5yPokU62RzKuhrlkRHDQSKMg3rEt62mS0YcqvsrfKnwVioAPaz 434tSOfyTH/Nkb5AtD+zV2qy+QFstZvoM72Lh8L656N8bd6lG4zR0GjnLIobJx+xIIuN XX8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gN8bLfv9; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hj12si325206ejb.577.2021.02.02.17.01.53; Tue, 02 Feb 2021 17:02:17 -0800 (PST) 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=@google.com header.s=20161025 header.b=gN8bLfv9; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236391AbhBBXZy (ORCPT + 99 others); Tue, 2 Feb 2021 18:25:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236318AbhBBXZu (ORCPT ); Tue, 2 Feb 2021 18:25:50 -0500 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 883A1C0613D6 for ; Tue, 2 Feb 2021 15:25:10 -0800 (PST) Received: by mail-oi1-x233.google.com with SMTP id w124so24747278oia.6 for ; Tue, 02 Feb 2021 15:25:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=/gSLnZEPcAuV/awfY6UzZKwpDjyBokFy8hWOpAWUFI8=; b=gN8bLfv9mwDrYvGm5hqd8P+CR6S4cYSBSl1tck8Op+Pu/pVI7M4uWo9rxosimmiycL 0Wly21iRhAci9ZIivfL1Ayzj++rnv/HE7hl/4SFLWGBPxlyrcTnEjoyKy5F398RvInnF ZVqTpwU0wINXNl39fYPkNKiFbmV1/BKnDaLQ6HBNZ94HZOZuXYAdixETXDHoZiPy5XPE gU0UnA+DL17oKz7mpT73edqPAp30xzZiS7x1xBz3jJ1vqzE+QHtpsMoxtr6SX7qsZMix ssM6SmUKLGLSGlnLR2Ab4wOVUdttlBtINR5EkxoKvYN+2RdlGZ76uDM7Nfc1CEjBkXQr wOsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=/gSLnZEPcAuV/awfY6UzZKwpDjyBokFy8hWOpAWUFI8=; b=E1GiEgdq5OwSunTwk3QiXYMb9MORpPmHVg3wXC/WCOwwULVADcR5CD3RLifQ83fsjR Rd/7FnPKd7iSQV/P+juLHLBt+YKK2kvOuyGsS0A1Zi7I1xTE+nHOM05zeUkHtMaEZn/S 1N1Te3k0Kus7dPHTHe+9ZWC4WAAYKXgh1s4JI2IXF/3cKF4Q5WpfHhkE/IaPfAnd6dH1 kt7IB1gF9t4hKs/WRAa79QJyPE0/mtgqDi1GnJGAbbPXGtoow/TW+3YqYVUlV8jlMBmA Z16lPV34e9hMowVFB5kSSPf/JD9oI3JwY5ErGso9tDgXCtp5eB1mr/62iOBwsBkg7dFS ZWWg== X-Gm-Message-State: AOAM533Yp9iNe1kqAcSSDxPf8NMgyjSp1/qH3CCxE0Rixn/JvSaPrJQD j+K8K2bzkfR8tFGYbZsyAVC+rA== X-Received: by 2002:a05:6808:2d7:: with SMTP id a23mr136950oid.161.1612308309724; Tue, 02 Feb 2021 15:25:09 -0800 (PST) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id s6sm63522oou.46.2021.02.02.15.25.08 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Tue, 02 Feb 2021 15:25:09 -0800 (PST) Date: Tue, 2 Feb 2021 15:24:56 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Axel Rasmussen cc: Hugh Dickins , Andrea Arcangeli , Andrew Morton , Mike Kravetz , Peter Xu , Linux MM , LKML Subject: Re: [PATCH] userfaultfd: hugetlbfs: only compile UFFD helpers if config enabled In-Reply-To: Message-ID: References: <20210202203127.3596707-1-axelrasmussen@google.com> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2 Feb 2021, Axel Rasmussen wrote: > On Tue, Feb 2, 2021 at 1:03 PM Hugh Dickins wrote: > > On Tue, 2 Feb 2021, Axel Rasmussen wrote: > > > > > For background, mm/userfaultfd.c provides a general mcopy_atomic > > > implementation. But some types of memory (e.g., hugetlb and shmem) need > > > a slightly different implementation, so they provide their own helpers > > > for this. In other words, userfaultfd is the only caller of this > > > function. > > > > > > This patch achieves two things: > > > > > > 1. Don't spend time compiling code which will end up never being > > > referenced anyway (a small build time optimization). > > > > > > 2. In future patches (e.g. [1]), we plan to extend the signature of > > > these helpers with UFFD-specific state (e.g., enums or structs defined > > > conditionally in userfaultfd_k.h). Once this happens, this patch will be > > > needed to avoid build errors (or, we'd need to define more UFFD-only > > > stuff unconditionally, which seems messier to me). > > > > > > Peter Xu suggested this be sent as a standalone patch, in the mailing > > > list discussion for [1]. > > > > > > [1] https://patchwork.kernel.org/project/linux-mm/list/?series=424091 > > > > > > Signed-off-by: Axel Rasmussen > > > --- > > > include/linux/hugetlb.h | 4 ++++ > > > mm/hugetlb.c | 2 ++ > > > 2 files changed, 6 insertions(+) > > > > Hi Axel, please also do the same to mm/shmem.c (perhaps you missed > > it because I did that long ago to our internal copy of mm/shmem.c). > > I had been largely ignoring shmem up to this point because my minor > fault handling series doesn't (yet) deal with it. But, I'll need to do > this later when I support shmem anyway, so happy to add it here. Oh, if this patch is going into a hugetlbfs series, skip mm/shmem.c for now (or keep it in, whichever's easiest for you): I caught sight of the "(e.g., hugetlb and shmem)" in the commit message above, and thought you had inadvertently missed out the shmem part - but now see that the patch title does say "userfaultfd: hugetlbfs:". Hugh