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 X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B731C3A5A6 for ; Thu, 19 Sep 2019 08:53:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AD9BE21927 for ; Thu, 19 Sep 2019 08:53:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=shipmail.org header.i=@shipmail.org header.b="GuAhR6Bm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD9BE21927 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shipmail.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4540F6B034B; Thu, 19 Sep 2019 04:53:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 404166B034C; Thu, 19 Sep 2019 04:53:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 319796B034D; Thu, 19 Sep 2019 04:53:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0034.hostedemail.com [216.40.44.34]) by kanga.kvack.org (Postfix) with ESMTP id 0BEB76B034B for ; Thu, 19 Sep 2019 04:53:53 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 6DD108243768 for ; Thu, 19 Sep 2019 08:53:52 +0000 (UTC) X-FDA: 75951057504.14.jar12_219432c37ce12 X-HE-Tag: jar12_219432c37ce12 X-Filterd-Recvd-Size: 3956 Received: from ste-pvt-msa2.bahnhof.se (ste-pvt-msa2.bahnhof.se [213.80.101.71]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Thu, 19 Sep 2019 08:53:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by ste-pvt-msa2.bahnhof.se (Postfix) with ESMTP id 4D6D23F7F6 for ; Thu, 19 Sep 2019 10:53:49 +0200 (CEST) Authentication-Results: ste-pvt-msa2.bahnhof.se; dkim=pass (1024-bit key; unprotected) header.d=shipmail.org header.i=@shipmail.org header.b=GuAhR6Bm; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at bahnhof.se Authentication-Results: ste-ftg-msa2.bahnhof.se (amavisd-new); dkim=pass (1024-bit key) header.d=shipmail.org Received: from ste-pvt-msa2.bahnhof.se ([127.0.0.1]) by localhost (ste-ftg-msa2.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QMeN64LL813g for ; Thu, 19 Sep 2019 10:53:44 +0200 (CEST) Received: from mail1.shipmail.org (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) (Authenticated sender: mb878879) by ste-pvt-msa2.bahnhof.se (Postfix) with ESMTPA id 726733F5D5 for ; Thu, 19 Sep 2019 10:53:44 +0200 (CEST) Received: from localhost.localdomain (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) by mail1.shipmail.org (Postfix) with ESMTPSA id EA0D83605DF for ; Thu, 19 Sep 2019 10:53:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1568883223; bh=D0FtnL9JT88rWUYAvLq3dWt0HPCLgCDjmqTHn65+8yo=; h=To:From:Subject:Date:From; b=GuAhR6Bmqhnz4v2N/D1mKMShllDriBWaF+8GEpCvwH7WJ6NaWQJMhZE/tWDebVm3D PaKQEJukwFyAKvWp73Ey7Hk3bNF4KJUnd/pCKL59hLHoa54+eTEs3HoojIAmEkJxSh 3sfuoNmyvvEcNceSpVCBWY3hI5rBd08wwopbvF8M= To: "linux-mm@kvack.org" From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m_=28VMware=29?= Subject: Huge pmds and puds for graphics questions Organization: VMware Inc. Message-ID: Date: Thu, 19 Sep 2019 10:53:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Bogosity: Ham, tests=bogofilter, spamicity=0.329764, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi! I'm looking at supporting huge pmds and puds on VM_MIXEDMAPs for the TTM graphics memory manager. While huge puds might not be that common, huge pmds will probably be. We would also want to support vrite-notify vmas, in which case we need to split the pud / pmds, and handle the write-notification on the pte level. Today we also support cow mappings, but I'm not sure anyone ever used it in this context. I figure in this case we just split the huge puds / pmds and we should be fine. In any case, over to the questions: In __handle_mm_fault() we call pmd_alloc() without considering puds being unstable (somewone faulting in a huge pud entry, or madvise() removing a huge pud entry). Is there some kind of special mechanism taking care of that potential race? https://elixir.bootlin.com/linux/latest/source/mm/memory.c#L3931 In wp_huge_pmd() and wp_huge_pud(), if huge_fault() returns VM_FAULT_FALLBACK, and there is an existing read-only huge entry, we don't split that entry, causing the write fault to be endlessly retried. Is this an oversight or is the huge_fault handler responsible for splitting the huge entry? https://elixir.bootlin.com/linux/latest/source/mm/memory.c#L3738 https://elixir.bootlin.com/linux/latest/source/mm/memory.c#L3769 Any insight or comments would be appreciated. Thanks, Thomas