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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 798A7C433EF for ; Thu, 21 Jul 2022 19:09:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233270AbiGUTJd (ORCPT ); Thu, 21 Jul 2022 15:09:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233243AbiGUTJ0 (ORCPT ); Thu, 21 Jul 2022 15:09:26 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DF21B8C146 for ; Thu, 21 Jul 2022 12:09:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658430564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ewgLO5BLUTwFzlaPTOrZbCbEaC1XqhfSuyvQTiqA3w8=; b=GIDRQZeEt9ZnMLZ0wXpstJ8sIHN6AE3klnLobKsMK0k0MvVzu2jDUwA7UvqB5P5VtDIsZX r5Pd3dEzuppOteqzV7LS+JhH4Xq3NgsqyKRPpdDgtZnFAQ5MAYrEAzDOgtADqcVCCs6GDl X8LQNud3ENbVvYMiNoSF01b1Nn5YBTM= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-428-g8oLJ8_YPO6zj798DAWaVg-1; Thu, 21 Jul 2022 15:09:22 -0400 X-MC-Unique: g8oLJ8_YPO6zj798DAWaVg-1 Received: by mail-qv1-f71.google.com with SMTP id ld29-20020a056214419d00b004740c1dda13so1608093qvb.5 for ; Thu, 21 Jul 2022 12:09:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ewgLO5BLUTwFzlaPTOrZbCbEaC1XqhfSuyvQTiqA3w8=; b=xlRtqe3Ve2yN15Bc+XLKBukdzBr3oIt9yq6UUHKN+oxMqnZavKXw360MzGUIb/QCNI 1i0NIMzPC7YSG6Gp6gYWGEVGEvrkRs4zRoMA5bgONvkEdaE4AH1mKmCC6AwkavcNCAqY 1NWn4HCGGQwJCqK7cOzb3TJm8WWopsMsHnU4flJaENsl0GJJet6dej09gIdx9n/7otev rOtRr+GNs/PRPIeAChkW8LVkDp7AeH0CzcKRGjakHMQ08vhXcw0KDFKuM1PXsG2ezxIh n6DElNABdD9Y4Wm/nHcETsPJDYcI//Rg6U/U2uUL8W447ai2pmuErFRViAW7xDduSW2c PZQA== X-Gm-Message-State: AJIora+cL5dYCfGJnadDIT+M7oQR/4oSIusQ72HVfe4uS1k9Kg+460OF pG72AINt/GSxvmtdCIBiAHyRxNGhk+0uX3hibU++xm5+QDoeN74i7UPew3z+pXv5QbQJPwKSBsx XoV+DoygnIWu+1P+XzCoWiBgK X-Received: by 2002:ad4:5cca:0:b0:473:ffee:5025 with SMTP id iu10-20020ad45cca000000b00473ffee5025mr10968256qvb.109.1658430562027; Thu, 21 Jul 2022 12:09:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ssC0zkU+AxnBoLQGT4WR/iZrLQwrRslzdmya+Z0mlVUu2iFBNLakGbhaHUZlNNYgTEA+A64w== X-Received: by 2002:ad4:5cca:0:b0:473:ffee:5025 with SMTP id iu10-20020ad45cca000000b00473ffee5025mr10968215qvb.109.1658430561546; Thu, 21 Jul 2022 12:09:21 -0700 (PDT) Received: from xz-m1.local (bras-base-aurron9127w-grc-35-70-27-3-10.dsl.bell.ca. [70.27.3.10]) by smtp.gmail.com with ESMTPSA id z11-20020ae9c10b000000b006a3325fd985sm1787584qki.13.2022.07.21.12.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 12:09:20 -0700 (PDT) Date: Thu, 21 Jul 2022 15:09:19 -0400 From: Peter Xu To: James Houghton Cc: Mike Kravetz , Muchun Song , David Hildenbrand , David Rientjes , Axel Rasmussen , Mina Almasry , Jue Wang , Manish Mishra , "Dr . David Alan Gilbert" , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 20/26] hugetlb: add support for high-granularity UFFDIO_CONTINUE Message-ID: References: <20220624173656.2033256-1-jthoughton@google.com> <20220624173656.2033256-21-jthoughton@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 20, 2022 at 01:58:06PM -0700, James Houghton wrote: > > > > > @@ -335,12 +337,16 @@ static __always_inline ssize_t __mcopy_atomic_hugetlb(struct mm_struct *dst_mm, > > > > > copied = 0; > > > > > page = NULL; > > > > > vma_hpagesize = vma_kernel_pagesize(dst_vma); > > > > > + if (use_hgm) > > > > > + vma_altpagesize = PAGE_SIZE; > > > > > > > > Do we need to check the "len" to know whether we should use sub-page > > > > mapping or original hpage size? E.g. any old UFFDIO_CONTINUE code will > > > > still want the old behavior I think. > > > > > > I think that's a fair point; however, if we enable HGM and the address > > > and len happen to be hstate-aligned > > > > The address can, but len (note! not "end" here) cannot? > > They both (dst_start and len) need to be hpage-aligned, otherwise we > won't be able to install hstate-sized PTEs. Like if we're installing > 4K at the beginning of a 1G hpage, we can't install a PUD, because we > only want to install that 4K. I'm still confused... Shouldn't one of the major goals of sub-page mapping is to grant user the capability to do UFFDIO_CONTINUE with len