Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3008671rwi; Fri, 21 Oct 2022 10:19:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6TAND45hou1C6A+yOdE0B2nV+3Yqda993r5Ky99cqULunWvDhuGjdb7JgVjlQFtbYJRWqB X-Received: by 2002:a17:907:1c96:b0:78d:fe6b:9891 with SMTP id nb22-20020a1709071c9600b0078dfe6b9891mr16435140ejc.746.1666372782384; Fri, 21 Oct 2022 10:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666372782; cv=none; d=google.com; s=arc-20160816; b=drxhQoTHxLpGOYXDClGesNjpLs7XuBFO0RbgqpqkF2k8S+1KqwfH4khgCYKKMTVpVl pTJVCQqOiWAOFn6p5/MffpAG7JThyYO1eOAieaqPg2E97zEA5Z71Ab2nWgXC4LMar8Yg mzpqMyxI/3uLllxtdbvxxO5fbmA+Kbj/Cq/ChDFuEYBB7NamNpKIXdKoMu2KlmGoKfwx T71nBtvGSTu1fsimHk2LqM7sDpMpSv0TZsW9dLBB4NhZuLKTIQY+Pi35GXzWwko1dVgM MeQ0CVGjVxJkcr/9gPebsqkxrf2ADtDys9h4reZF7Oug8LOxUyjQFYGYLsodZRL2XXe6 xSXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=PyHYN0BZDkl5R+we+ok2phOJ6Br6Eo9HknyqZ/f6blI=; b=0F1YEoHfNdMx1/0mBUVwyaQ7tTFHNuFt/ZoLO14IKecwP9Q4oWlH4KuS9OSNp5UA2s kFoB9Ig798ySvHFL2bWNbspSrD2ojceCVws9EgtsWLUt9yzqDSBYzwpIOYXtnARG8Te0 +1OUASopNEb/9Dn4HzO9EjQyraF32HKPyrFfpdUYcgW7FxxQtuSHW02R3qJ8VY91qp8V LJlyaiCokkn1NFJp4iZhlJSia/ZG+y6op2KsN6uQ25sTZKHX7SEVa3Yz5zmgOjhXy/Zo 7/LLhMrBxISJbF8+Lrpf5EmOB15VKf3Bub2WgDHf7r612qx+B7PrQ0G4C6qg33QrlUrO Tfpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=k4YSYz8E; 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 ko3-20020a170907986300b0073c100331cbsi17239144ejc.384.2022.10.21.10.19.16; Fri, 21 Oct 2022 10:19:42 -0700 (PDT) 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=k4YSYz8E; 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 S230269AbiJUQhV (ORCPT + 99 others); Fri, 21 Oct 2022 12:37:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230285AbiJUQhR (ORCPT ); Fri, 21 Oct 2022 12:37:17 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 597BE26B6FE for ; Fri, 21 Oct 2022 09:37:16 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 189-20020a2516c6000000b006bbbcc3dd9bso3751596ybw.15 for ; Fri, 21 Oct 2022 09:37:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=PyHYN0BZDkl5R+we+ok2phOJ6Br6Eo9HknyqZ/f6blI=; b=k4YSYz8Eqmi/g8cLFz6T0cXUQewY5TrykcLo3J6vLFEFW+zVg07R+6L2pGz4hYkpjh YeRSCb3IFz9Lx2ADjHguv3Bcl2NzvlSG0UaHoorM2hx35cBJZbjKBwoRh5rxOv53PUtH 6JfJ5o1zynpQr144bkb1sr56ifBdHTV2T5B0ZasYzlZTGp6KE2/lEQXR+tm8Fb9Lka+0 ayKHUamTEhmRm9nNm0eDQcbCVIN9xZXd7NlM3NhcPsDm0mH+iuwgerGgDIztDwXkgbUe GoioeQ/qERTklWRzJZVlo//zRoztIQ/e5hovtXxIkbCWhIHv+mW+9bZYapriY1Hylf8f cQlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PyHYN0BZDkl5R+we+ok2phOJ6Br6Eo9HknyqZ/f6blI=; b=M/7XFWEEWXPAwLkTN5fa931ccBYhOHovW3gYxyyZCKZMjxk4IB9n+LzWGYoQJhQef+ xc4VK/jWCgvMhyHIerWdslKj77BYKnRawUa3u1OKFpMmQ0P7K4BcBjmDkSf/ugYDQ+BT BwufZdS08PA7MJp1KAYLCuGYRynxzrUG19DBHeTXNqvGsoaGxQH5oNVJySI8JWpbTmQ/ OZGUcZJah0q1/umWDVQITq8PXjsgpnWu9+a11EpBH1/lmBPxPkyM2EyQ+2TO+BC1zI3b 8ThG2JRZ1f0ZZFX0R2hkoPj9KpGwZxIfy9q6MMELzGsuBnTOghkC08c8LOhvpQtjeP5d 7tLQ== X-Gm-Message-State: ACrzQf2tsD01D5VtFxZ2J0Eokeu7ZHQ2sc5ms5h217nm/5ajPf7o2L63 ZoMlq0Gte/bgIOvnAD0U/C4ZUnlEwMLZDKAl X-Received: from jthoughton.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2a4f]) (user=jthoughton job=sendgmr) by 2002:a25:6a8b:0:b0:6c0:5610:b6f1 with SMTP id f133-20020a256a8b000000b006c05610b6f1mr17608546ybc.273.1666370235466; Fri, 21 Oct 2022 09:37:15 -0700 (PDT) Date: Fri, 21 Oct 2022 16:36:17 +0000 In-Reply-To: <20221021163703.3218176-1-jthoughton@google.com> Mime-Version: 1.0 References: <20221021163703.3218176-1-jthoughton@google.com> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog Message-ID: <20221021163703.3218176-2-jthoughton@google.com> Subject: [RFC PATCH v2 01/47] hugetlb: don't set PageUptodate for UFFDIO_CONTINUE From: James Houghton To: Mike Kravetz , Muchun Song , Peter Xu Cc: 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, James Houghton Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_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 This is how it should have been to begin with. It would be very bad if we actually set PageUptodate with a UFFDIO_CONTINUE, as UFFDIO_CONTINUE doesn't actually set/update the contents of the page, so we would be exposing a non-zeroed page to the user. The reason this change is being made now is because UFFDIO_CONTINUEs on subpages definitely shouldn't set this page flag on the head page. Signed-off-by: James Houghton --- mm/hugetlb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 1a7dc7b2e16c..650761cdd2f6 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6097,7 +6097,10 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, * preceding stores to the page contents become visible before * the set_pte_at() write. */ - __SetPageUptodate(page); + if (!is_continue) + __SetPageUptodate(page); + else + VM_WARN_ON_ONCE_PAGE(!PageUptodate(page), page); /* Add shared, newly allocated pages to the page cache. */ if (vm_shared && !is_continue) { -- 2.38.0.135.g90850a2211-goog