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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1355C4332F for ; Wed, 16 Nov 2022 23:30:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 063756B0072; Wed, 16 Nov 2022 18:30:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F2E376B0073; Wed, 16 Nov 2022 18:30:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DCFE56B0074; Wed, 16 Nov 2022 18:30:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id C9CA76B0072 for ; Wed, 16 Nov 2022 18:30:12 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 9C528AB843 for ; Wed, 16 Nov 2022 23:30:12 +0000 (UTC) X-FDA: 80140901064.25.BB369E9 Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) by imf06.hostedemail.com (Postfix) with ESMTP id 39129180002 for ; Wed, 16 Nov 2022 23:30:12 +0000 (UTC) Received: by mail-yb1-f180.google.com with SMTP id k84so18688470ybk.3 for ; Wed, 16 Nov 2022 15:30:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=a2sf9AhIyxwq3f7k04xbxV/djLKynzQPlhmCrV1ud2M=; b=Qo93yHrO/cjY0wFuD2EmAVOKPCsf6ZPhGey4RKIkCNkiGFyxwZxmS/00l1hMtoGOD0 U7ZJUzKaZnStQ3IBcuGbDogIr4AcCA1i66bIXX7P4OVW9AegLXaNnDveWZZqOFul6ZQe e+D3KRM5TdZZ4L1y8xCyexo972WrN4hK89Gc43LeEjwSIVKNuFN2w607uQeozB6KZp8H qm6Kki0qt7dtAjDS+4qPMRrBBfL4ursRZ1ZkVbhiK7RafVaRtELV32mKv+3wICMC8bW+ /Vr1lIPw74pG891UsMSHGRdh7uWMfi6kW0kzCHZ/lPbILUgK6pP/NRBTiSQOydfGAfS1 QMlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a2sf9AhIyxwq3f7k04xbxV/djLKynzQPlhmCrV1ud2M=; b=s94pN8RR8CTYODNw9VlUd2ycJrL+oSSWT+lL25vNGaG1uZQL7osZbJovaAaXngdCq2 iFAE4k2RJ0TaEeTvPJ5YRmGnU6dCjS6huOyqK/aR+ux9OmOPzbzy5DAQJqetCpQlxQBO 6Qh2zEEqX2lkJ5bi6iIpfKgwu7KLN2KIO9qjJ01wtwbEGinE6pDpWoSUrxB49Sq6+i3N NuyfNs2JKXHmZz3P5yPIdV/X11jtq1Z3+bAmd5BYjcSiuP7oQy6mBXwbfus8PwC/Yeuc MfX/K3Obcce5J192O8E9zF/xQrZJVZOD0VNttVhlVsC78oDoIOvmWd9fpfbAzRsPkDda tWYw== X-Gm-Message-State: ANoB5playcP2dGjnbMhV10iVTfdZOGY4+yZ40Qz0nowfJ2SYfgdwi1EZ 0JFYT8sZ66gHpECdO0GK63frJCRSFoOT27yPiWpn8A== X-Google-Smtp-Source: AA0mqf7bMhtWNzeLubNMtXbobUmsjuWfRrz+dR3YatVt5qGdk3EPTgP/Uo7EWjEg3KGlOYv382zPgQUp5FnoXWdjlkM= X-Received: by 2002:a25:bfcf:0:b0:6b9:616:6994 with SMTP id q15-20020a25bfcf000000b006b906166994mr6881ybm.126.1668641411295; Wed, 16 Nov 2022 15:30:11 -0800 (PST) MIME-Version: 1.0 References: <20221021163703.3218176-1-jthoughton@google.com> <20221021163703.3218176-34-jthoughton@google.com> In-Reply-To: From: James Houghton Date: Wed, 16 Nov 2022 15:30:00 -0800 Message-ID: Subject: Re: [RFC PATCH v2 33/47] userfaultfd: add UFFD_FEATURE_MINOR_HUGETLBFS_HGM To: Peter Xu Cc: Mike Kravetz , Muchun Song , David Hildenbrand , David Rientjes , Axel Rasmussen , Mina Almasry , "Zach O'Keefe" , Manish Mishra , Naoya Horiguchi , "Dr . David Alan Gilbert" , "Matthew Wilcox (Oracle)" , Vlastimil Babka , Baolin Wang , Miaohe Lin , Yang Shi , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668641412; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=a2sf9AhIyxwq3f7k04xbxV/djLKynzQPlhmCrV1ud2M=; b=HGR8L7M0mogcblFAr85fJF9eWFDY42paD/KbqupPd5dVGLZKcuuXEf7/zHKuNtZmnU7t9X O6NipjeC2s7/MGVHcftVFC3WQQUWYSD6JVd+088QZoctSwSFxAZwlsBQAevlTm9wBJhVbJ vsPkzZv8WThCvJdKZlQhgZmENAZX+eI= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Qo93yHrO; spf=pass (imf06.hostedemail.com: domain of jthoughton@google.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=jthoughton@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668641412; a=rsa-sha256; cv=none; b=AHs80ZdgFtTo/YDMaG8wc3ZPTpu/S3xROcLnUXK4U9yQ2XA4HaVA0wVc5kq23LXs3AhEFO 2z9iilzKQmuA7gCQ1yrl4jjNuQ3yM3e9mJOzIXS5qVF9xLU/Iu5cmAt9P0UKrt3Nw0yhbw Pt9c3p2wWVx4zwFurdcrdUMidMjFVqc= X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 39129180002 Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Qo93yHrO; spf=pass (imf06.hostedemail.com: domain of jthoughton@google.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=jthoughton@google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: w5gsqezb9554554jshyted5kx7f1b6nj X-HE-Tag: 1668641412-588919 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 Wed, Nov 16, 2022 at 2:28 PM Peter Xu wrote: > > On Fri, Oct 21, 2022 at 04:36:49PM +0000, James Houghton wrote: > > Userspace must provide this new feature when it calls UFFDIO_API to > > enable HGM. Userspace can check if the feature exists in > > uffdio_api.features, and if it does not exist, the kernel does not > > support and therefore did not enable HGM. > > > > Signed-off-by: James Houghton > > It's still slightly a pity that this can only be enabled by an uffd context > plus a minor fault, so generic hugetlb users cannot directly leverage this. The idea here is that, for applications that can conceivably benefit from HGM, we have a mechanism for enabling it for that application. So this patch creates that mechanism for userfaultfd/UFFDIO_CONTINUE. I prefer this approach over something more general like MADV_ENABLE_HGM or something. For hwpoison, HGM will be automatically enabled, but that isn't implemented in this series. We could also extend MADV_DONTNEED to do high-granularity unmapping in some way, but that also isn't attempted here. I'm sure that if there are other cases where HGM may be useful, we can add/change some uapi to make it possible to take advantage HGM. - James > > The patch itself looks good. > > -- > Peter Xu >