Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3437698rwl; Tue, 27 Dec 2022 09:06:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXtFXBpjPmbtaPsimgmwC/RqUi+4EWjGuauDQGdBLWMuw0OzMoJEi0Nz0L5otW/8ZzhMW+ib X-Received: by 2002:a17:90b:1f90:b0:219:d274:ba43 with SMTP id so16-20020a17090b1f9000b00219d274ba43mr25528248pjb.47.1672160777266; Tue, 27 Dec 2022 09:06:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672160777; cv=none; d=google.com; s=arc-20160816; b=Hr2dlDJ3PIP7sgHfOqA4uVL+Qyhf4FgUL2ayzdapYPIL9+olLCPAvmSYzgJ/PX5cCf 66q3U8hrXHQJrtZtAx+gf9J6cdMDv+GEtKRz+fZcAkR6zsazDY0RSb3BmXdZxVaBdHN4 Ettwb64U73PZLFmev2QLo3YqY1N3AbKrNj5lwrBHST7yROb5w/w7/uXFNSx6nj4jpOFJ CfPH34OTVBgYIaaK35DXs0+UYFT0DOCHBGDpBOCdB6Ou4K6em9HlaGDXbZaggetRWRtc aXujPXltJQQ2j3B7DKiuKFUMVk8kL3ElnQBVLxS/zOKybo9bqGqhLQ/mFBISTeYHpqUa mRgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ZuZBQ+L+0/ZqHqWlgeQLK5JnjyvDB5tbr4vfEmfM+Fw=; b=dQumF3jK+FuFDyh3er7qgOip5vOsU+ReXJ0gW7h8MjD+Y/Qd4OfP/kUlMakVHA2NCv BVlU8MxD20s/+I/Cqe6DkEcpB6+gQQF+cqFA8L5wFYXe/LGspY4e98zHlg3W8rB+aLqr LHe37Uz+ShWgCgtNerWb6l0uOk1rVKWi5mzmfKlhA/pzKQ5GFEN0wz2WRLyGMivp64Tv MPclumXQz20am4d4yHWrtLv9EkPolj9DtScghThySCbrzRS2E/WbLxWm5wOoAMPEjYYV xcbgwbCqS/pmLGdE0oQWpLtI1LoZw3+QWydnEZIo0XpE6zwGlbgBkCq9dUjPsCoebIIc L6Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=evI4PAAF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a12-20020a63d20c000000b00477e302ee63si14903542pgg.552.2022.12.27.09.06.05; Tue, 27 Dec 2022 09:06:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=evI4PAAF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231769AbiL0RDM (ORCPT + 66 others); Tue, 27 Dec 2022 12:03:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231739AbiL0RDH (ORCPT ); Tue, 27 Dec 2022 12:03:07 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F104A19A for ; Tue, 27 Dec 2022 09:03:06 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id y8so12882838wrl.13 for ; Tue, 27 Dec 2022 09:03:06 -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=ZuZBQ+L+0/ZqHqWlgeQLK5JnjyvDB5tbr4vfEmfM+Fw=; b=evI4PAAF6tj+QUQqNK4wWdSLrvtCi2JscjdLHeZNcQM/+rdxH8ykhmtxECH30THm5V iGs7Il9f2Od7bZaLRGOhVmedf7XOcTDGFKE9rX8N7Mw5OFNdie0O62s1OCHrzaL8tUr7 pYUhTyL8ELxE4SKdfZK+enSOeL4Bi/MnPpAUjhKYaXExptSK9RzgI8jjNf21XN/0mjTg ThzJqUNBdmuqLhVwYJqU+CElUnTmALKONofsJ9xp8PT3OvSIedX6lj6ZnBpUzHrLo0BD H8Aw9m8lheLUwObVzD/k2yhJu0S9WIBQAeKTeFdjLVTnlXYmu8BlNpRD9vTJEbZqcUJy RDGQ== 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=ZuZBQ+L+0/ZqHqWlgeQLK5JnjyvDB5tbr4vfEmfM+Fw=; b=3PlSj/oTtGlnBKQxrVOmmtROrZdO4rZHs2xEU8Xt4EZiXxdnfWF0mOsAunvFluYRUU f6DnkELmdm9oaBP3WJyQmi90tR260ZKOt2zBxfFHRuFkRvjhOvX1s3iRinF7cVSUObyS lDwhuHX0LpxC+jc/Idy3riEcyv7nVcfk0LGorY9Um54TI3h1SGOBuGWip8lkN3mdS2/e mRYXeFX+I93EHbc/os16ty1GplGlmUL3ZHAs1hrKM3xVvQU7Zpx7CcXxvX+G1D0wjLU4 By9GlAiJDK0QgjF5EfCExs72hrIyBOfVJ5oUUoIwrKqeDZ4SmoDzC8AXqb/X3F8ttYxz Fkxw== X-Gm-Message-State: AFqh2kqMpUNLYWPC5qPNY6YbKSjx6j2/GZFtPUOrAHGz+VJgHZA17RA1 xn5y54g0ViOKWFhNwbHw3X9K2xCaDKAwegUCdhqAwg== X-Received: by 2002:a5d:6148:0:b0:280:91ea:29b7 with SMTP id y8-20020a5d6148000000b0028091ea29b7mr167070wrt.98.1672160584923; Tue, 27 Dec 2022 09:03:04 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: James Houghton Date: Tue, 27 Dec 2022 12:02:52 -0500 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" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 22, 2022 at 9:30 AM Peter Xu wrote: > > On Wed, Dec 21, 2022 at 08:24:45PM -0500, James Houghton wrote: > > Not sure what the best name for this flag is either. MADV_ENABLE_HGM > > sounds ok. MADV_HUGETLB_HGM or MADV_HUGETLB_SMALL_PAGES could work > > too. No need to figure it out now. > > One more option to consider is MADV_SPLIT (hopefully to be more generic). > > We already decided to reuse thp MADV_COLLAPSE, we can also introduce > MADV_SPLIT and leave thp for later if it can be anything helpful (I > remember we used to discuss this for thp split). > > For hugetlb one SPLIT should enable hgm advise bit on the vma forever. MADV_SPLIT sounds okay to me -- we'll see how it turns out when I send v1. However, there's an interesting API question regarding what address userfaultfd provides. We previously required UFFD_FEATURE_EXACT_ADDRESS when you specified UFFD_FEATURE_MINOR_HUGETLBFS_HGM so that there was no ambiguity. Now, we can do: 1. When MADV_SPLIT is given, userfaultfd will now round addresses to PAGE_SIZE instead of huge_page_size(hstate), and UFFD_FEATURE_EXACT_ADDRESS is not needed. 2. Don't change anything. A user must know to provide UFFD_FEATURE_EXACT_ADDRESS to get the real address, otherwise they get an (unusable) hugepage-aligned address. I think #1 sounds fine; let me know if you disagree. Thanks! - James