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 32D80C433EF for ; Thu, 21 Jul 2022 19:09:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7883B8E0001; Thu, 21 Jul 2022 15:09:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 738F56B0073; Thu, 21 Jul 2022 15:09:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5FFE98E0001; Thu, 21 Jul 2022 15:09:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 518426B0071 for ; Thu, 21 Jul 2022 15:09:27 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0DC98A0A4E for ; Thu, 21 Jul 2022 19:09:27 +0000 (UTC) X-FDA: 79712045574.04.7805874 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf09.hostedemail.com (Postfix) with ESMTP id 90B6714001D for ; Thu, 21 Jul 2022 19:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658430566; 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=KqaxNqJPRH+BrLF//mDKufxfVBaZpl61GVxQWAY6rs58E5JmAmO18lR1MEf1koQHgzd5rm /bg2uvsT+VvbJSI7LauGH5uDVnto1GQwIYE4idFO1afNrdlLyzt9vlMeVpZxH+HvFaIhnY ZY5398rPfZjVKnHFXcAXVZQGKZoO9iw= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-468-cBcR1IJGML2pO2kxjSYIeA-1; Thu, 21 Jul 2022 15:09:22 -0400 X-MC-Unique: cBcR1IJGML2pO2kxjSYIeA-1 Received: by mail-qv1-f70.google.com with SMTP id p6-20020a0c8c86000000b004731e63c75bso1618970qvb.10 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=XrcUokXLdhI9Xmd8Y5fU61+8ZZi/rjvb5t/auyjGGf03Lw06mBYfjGE3YzxBVY607n nKI4P/2iFEKDP2Qs2EXkvqAFeZk1qLoFAWL/zwziCP3TkEpW6bntCGU5r6SPcCg3bFCa 0/crDhwPwtnCnfx/2NqcCFB5sUFd6QhmkiaQYsjmeYpufHzGKgp8690hhGAHKcIX874o tTLGxXQqLsvwUXhF4GlTo/RvtzCadvkgQMm/oeUR1vEafU8as2vw48HWtk8oFJZRmYjt lKLPFvMtkM9DfudWhUxJ2BP39TqhMRBqLLp6Qf4+7oDa87Q8fjnXO5yRALhkvU+cnYX1 /sTA== X-Gm-Message-State: AJIora9Hna4Jrdr7CxMjVXGJBNZOXNkT/ji3rZBC5u4rzeks4LGDG4ix X0Kqb+NSo5KV74cXM6mJqMBPnh0e3b03knT/PHyDx1csfkmInu+kgNFqkYs1Ggfs69v2IDHl20L Vxmm1kfMXfdo= X-Received: by 2002:ad4:5cca:0:b0:473:ffee:5025 with SMTP id iu10-20020ad45cca000000b00473ffee5025mr10968257qvb.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 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658430566; a=rsa-sha256; cv=none; b=uUagXQw/fCHwu5lsdLq63ESxZBu1ztcIAl0R9T+/oe0z2a64YTfmXrR9txp+CIxrVieteG sIP7pXrUPOG9z+orGGjxvat2zdVrcW3IhyE+33A+J0aRPUwA1azQ28cq352O+BN9DozcE6 QNo4ztXlyBTkDrSItuMZAcxexp5cPto= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KqaxNqJP; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf09.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658430566; 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=ewgLO5BLUTwFzlaPTOrZbCbEaC1XqhfSuyvQTiqA3w8=; b=rTk5nXFJaU0JrwEDOjbVSUPtB+9agrw+ehVqYw+6SO2wAr6i/QqrCmi0Fo+lkAeknxD5N6 N/FBIZ5BcWt3TGxmQk1f6hTcNi6tOp3n6HFGkSO60OIvhFGDFZHfaJNh0BA353xWbcCGC/ KwG/ZbhLzilCmDANsuDVFaQBBatMuBI= Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KqaxNqJP; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf09.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 90B6714001D X-Stat-Signature: m4sryerecizsofksddaisdw9cc9bs3x4 X-Rspam-User: X-HE-Tag: 1658430566-79160 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, 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