From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-24.8 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF547C433E0 for ; Tue, 2 Feb 2021 23:25:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5A03364F6A for ; Tue, 2 Feb 2021 23:25:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5A03364F6A Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A6D406B0005; Tue, 2 Feb 2021 18:25:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A1D3F6B006C; Tue, 2 Feb 2021 18:25:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E54E6B006E; Tue, 2 Feb 2021 18:25:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0125.hostedemail.com [216.40.44.125]) by kanga.kvack.org (Postfix) with ESMTP id 77D656B0005 for ; Tue, 2 Feb 2021 18:25:11 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 40BBD8249980 for ; Tue, 2 Feb 2021 23:25:11 +0000 (UTC) X-FDA: 77774910822.25.bait11_2703a65275ce Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 17A621804E3A1 for ; Tue, 2 Feb 2021 23:25:11 +0000 (UTC) X-HE-Tag: bait11_2703a65275ce X-Filterd-Recvd-Size: 5502 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Tue, 2 Feb 2021 23:25:10 +0000 (UTC) Received: by mail-oi1-f170.google.com with SMTP id k25so24746793oik.13 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=YjvM0dSUbFhQR6Dfo0XTioNk4AlX3gF8idhuxcZPJeu4pHW3xdTccK6jDSOSSQNqie t4tCi3aPKOXlBPdpFify8DyXlzmypReX8spC9lEyvG9QGosbAG1nlCWMGiCqx6BfmOln YzLJ8N5a4M8YpRHhPmHxPFegTsYl4/ehX654SGpfq2McjRqEOaLTK/xunapbu/zbnbSp HMTV/5FxfXtAhc4AltgkLAuR+NJFvLauGkf0RDXea3SxXv02nnTX1/PCIU09E6g89Uiy 3o7gYccpE+VH4apvABeUd3kEJ8UrOBXmUqsBT4Vq3FCYDRnS3Ul8orvQBs4FxgyayMTM 2sHQ== X-Gm-Message-State: AOAM532L3oJP4N4g9FjajQemVk0A/gPoO75ob/66cWgApNMN2CtQiM4j Kc16M9HV2yopfnJqFIyKiwEIEQ== X-Google-Smtp-Source: ABdhPJwm6bJER42qUgmaVSlEMU7XhKJA3Gi7ENTmsiKtMWgrVtpa4B4SmwR+4WmD1/Wfda6Lh5pOrw== 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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