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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5AD56C87FD3 for ; Thu, 29 Aug 2024 18:50:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:In-Reply-To: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LFCmp1yoRO+i1Fo2RkC+TtCKMiDRvz30b3MajzW3nrI=; b=MZPDQsfzt+NNjJfaQ4X3cwXeGz XnA+CNDAh/fXV8ftyRAKGom18MoJZozFH27DtLYUTWhEjOAN6XDqGtQ3cZQQLzMTR66j6o2RVilrL F6YVmePQxP76hTKNrSrrGecMhb2LfY0DRgBl4Xi2q3+V540KHflCQH0BFXUp4PI3ZYzX2RCUekACP 3cJ5Jbm5l0eiyXDzNeF8BrcO7QAWh6smnwZ8FGqPiZGmxJEq/iTXjwgeI/8SpJZl4dTatOUURWvE5 zpPplUNVfM/dov4KH2EVbmGKuvkGtHCV5gq9j3+JFpgp+aHcZUHvZl+IRYR6xGNY/9WIoaQyfHUKJ hGlDS6tg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjkDw-00000003G5U-0HA9; Thu, 29 Aug 2024 18:50:24 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjkD4-00000003FsV-01Bj for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 18:49:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724957368; 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=LFCmp1yoRO+i1Fo2RkC+TtCKMiDRvz30b3MajzW3nrI=; b=elyTv0ibn0UW4h8tlJ5uwGUEp26BFdq+bbhmBPK666MmP+oga9p3fYnMxA/6CVsjCpDo3A oGB2BZn7+Ce5O4FivDkO78GTS361S9OlN0ZjJTMGdwVQHfxUmjuSuQ6jwUaWtTY1LurBXw z8Sf5buNcj1JbCy4x6f1RAJwzI6lsIc= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-32-I25h1s0dMk6Kt9Yyz8kSQA-1; Thu, 29 Aug 2024 14:49:27 -0400 X-MC-Unique: I25h1s0dMk6Kt9Yyz8kSQA-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7a7ff78ce40so199567285a.1 for ; Thu, 29 Aug 2024 11:49:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724957367; x=1725562167; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LFCmp1yoRO+i1Fo2RkC+TtCKMiDRvz30b3MajzW3nrI=; b=R0DbRDFp2WeJDSDyW70My8oDfjlrPR8aFsivINwOAmMJBl7Y5W5qEmcUaEIIz3rlEI Fjwgaao/9mskyFmwejofQw63Z7PzcXppF43n++3HAZUVE1Pfb3PJBRXMuWxh6iuwja3K P2HYbZ9EJ/4k/pDYOwQQ20rg7RrUGgVT/iQDVPpbfJXYjfI2AvYVHg1BRQ/puFKKCwmI HvVKKHD2upRpKzfKhPqKhY1iWop43P0tQ0VIwmn96HP9CeYyJ0TerRXCzmKDXkVZr8LB zw0vfnhT+RJqoBUJpzQT0LwJIG/OGtGh3glq8hKXZtllG7hf4ZXAn6o7e4P5GY63Mpcy w5pw== X-Forwarded-Encrypted: i=1; AJvYcCVxoVo+RPtm1BjmY9aUbDhxoDDhfMbRmxC2fb4ZjJeZzrbCPbCoBg5ah/eYpBFX/r9ngpC1RBNqSOItiNSmgX5P@lists.infradead.org X-Gm-Message-State: AOJu0Yw53WtPYHOxvARWDx2eiTwR+CaTgRgxV71xPl9IAbKGpNkOEHzG 3wRxd/V9vsi+7gBd/4I9tUcR3gk6lqrKro1+/NWrok0sTh7gBkCHtEu0ZVsy3t/fH5RfzHJK1SM dOUt1diFGS5ApCKeW2XgHK/rs7mQ/Dlq4H6BcF4rxl9oPXKvoHTLmmXuXJwKAFYCLPg6xRPhm X-Received: by 2002:a05:620a:2698:b0:79f:8f3:6ad4 with SMTP id af79cd13be357-7a804189d7emr400078985a.1.1724957366852; Thu, 29 Aug 2024 11:49:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGCqY9sQY/plh+UMSdlovT6VfMPD3RnFHECf4IOnU0YGP0F/YZ2eWEcEkgRO7YJ9NGFLEjd+Q== X-Received: by 2002:a05:620a:2698:b0:79f:8f3:6ad4 with SMTP id af79cd13be357-7a804189d7emr400076685a.1.1724957366521; Thu, 29 Aug 2024 11:49:26 -0700 (PDT) Received: from x1n (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a806bfb8a1sm75924485a.5.2024.08.29.11.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 11:49:26 -0700 (PDT) Date: Thu, 29 Aug 2024 14:49:23 -0400 From: Peter Xu To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Gavin Shan , Catalin Marinas , x86@kernel.org, Ingo Molnar , Andrew Morton , Paolo Bonzini , Dave Hansen , Thomas Gleixner , Alistair Popple , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sean Christopherson , Oscar Salvador , Jason Gunthorpe , Borislav Petkov , Zi Yan , Axel Rasmussen , Yan Zhao , Will Deacon , Kefeng Wang , Alex Williamson Subject: Re: [PATCH v2 06/19] mm/pagewalk: Check pfnmap for folio_walk_start() Message-ID: References: <20240826204353.2228736-1-peterx@redhat.com> <20240826204353.2228736-7-peterx@redhat.com> <9f9d7e96-b135-4830-b528-37418ae7bbfd@redhat.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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_114930_139488_54AC0567 X-CRM114-Status: GOOD ( 36.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Aug 29, 2024 at 05:10:15PM +0200, David Hildenbrand wrote: > > > > > > > > If you prefer vm_normal_page_pud() to be defined and check pud_special() > > > > there, I can do that. But again, I don't yet see how that can make a > > > > functional difference considering the so far very limited usage of the > > > > special bit, and wonder whether we can do that on top when it became > > > > necessary (and when we start to have functional requirement of such). > > > > > > I hope my explanation why pte_special() even exists and how it is used makes > > > it clearer. > > > > > > It's not that much code to handle it like pte_special(), really. I don't > > > expect you to teach GUP-slow about vm_normal_page() etc. > > > > One thing I can do here is I move the pmd_special() check into the existing > > vm_normal_page_pmd(), then it'll be a fixup on top of this patch: > > > > ===8<=== > > diff --git a/mm/memory.c b/mm/memory.c > > index 288f81a8698e..42674c0748cb 100644 > > --- a/mm/memory.c > > +++ b/mm/memory.c > > @@ -672,11 +672,10 @@ struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr, > > { > > unsigned long pfn = pmd_pfn(pmd); > > - /* > > - * There is no pmd_special() but there may be special pmds, e.g. > > - * in a direct-access (dax) mapping, so let's just replicate the > > - * !CONFIG_ARCH_HAS_PTE_SPECIAL case from vm_normal_page() here. > > - */ > > + /* Currently it's only used for huge pfnmaps */ > > + if (unlikely(pmd_special(pmd))) > > + return NULL; > > > Better. > > I'd appreciate a vm_normal_page_pud(), but I guess I have to be the one > cleaning up the mess after you. I'll prepare either a fixup patch for above, or repost if there're more changes. Again, please leave explicit comment please. As I mentioned, to me vm_normal_page_pud() currently should only contain pud_special() check, as most of the things in pmd/pte don't seem to apply. I don't feel strongly to add that wrapper yet in this case, but if you can elaborate what you're suggesting otherwise, it may help me to understand what you're looking for, then I can try to address them. Or if you prefer some cleanup patch by yourself, please go ahead. -- Peter Xu