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 8D7A1C5475B for ; Fri, 8 Mar 2024 06:50:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=k4ptztuZcFr2rFGkTxDo6d5Pf5QqODcca6xCMsJ5ne0=; b=Rg4vWKdimMZm/W X9hfPbbpapypgB96fZwpLkL+3KRfiNGkZRUnSfYj99uVXx9QloLVw8lWxegOUQrIOtthKT95lHD2z pAluzzORKdBLjd7tb7eLoqCh/ax6ns5mfO/MGwOdnDQnPVfvWK+ZteWRauI4kNbppI8vQdqB5xd08 JZQCsXMojfeuRQzjqIO83KBC/AFzvFIl6QzT96w0Q/W8z1XoK3kWmSHLgykK+eMeJySijiVtjoWru +Dm019pwB8FDtGQiW1ZrSPx8yx0Jc83oT4uXjY0s4nW3KnELye9LSF1T9YjZxCTYrVkRCNqnijhXK FdgsvYhiZX7ipacLM7NQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1riU3z-000000082Fq-3TxW; Fri, 08 Mar 2024 06:50:39 +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 1riU3w-000000082EW-1WQU for linux-arm-kernel@lists.infradead.org; Fri, 08 Mar 2024 06:50:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709880633; 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=epRg3dGewUcblPePlS+KzZdY/GgoToAmRabId8Bpp4I=; b=V9/TbEuYrZMfR05zpGMs6kOM93WEA9kdJDMKKbjRxJi8UOuzlft06EXzvMKJ7UTFAmNw+6 pMl/V0Gnbvkl1Ra/NfzBUOBZyI8gWQfCcHA2CS+y+nqDLfnHyIEkxMuO7e8LxIum2845kz uaY7JGDe+1uPEZjD6Z1oPsHLTWzHbPY= Received: from mail-oa1-f69.google.com (mail-oa1-f69.google.com [209.85.160.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-354-mdnMi98oPHOBDahaempWFg-1; Fri, 08 Mar 2024 01:50:31 -0500 X-MC-Unique: mdnMi98oPHOBDahaempWFg-1 Received: by mail-oa1-f69.google.com with SMTP id 586e51a60fabf-221994722b9so148913fac.1 for ; Thu, 07 Mar 2024 22:50:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709880631; x=1710485431; 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=epRg3dGewUcblPePlS+KzZdY/GgoToAmRabId8Bpp4I=; b=A/ssI4NzjEvjAKIbxDnJw5f/yEMVend4sY5q0u7ng5O+WSlD2fKxAuBVQDKeSFcUm1 gf63jZCKUCQPhD4wZDE0wGr4SYSerrn10gpKvylYxYOO/nUQXPlztzyM41A5A/tUtjEH q7SJ7IoXhPfzi0j6MHvbN3zdvdvC3lBeOZ4IHcfLSQqGYZ6xO6gQtBw3eBADUtCshGes CuS7i+VV+/9vkQ4xZC+fr3ROz2GXnd6hJSFEKmuG6RBkAnI/3nCFeqKsnnmghHHi8a5n Z0PeBvcMjOTUwko4Kold5EEVsNIjKVXqBifzCDdHHIYGwE1RL929W9u9PjEJi/dNQ/Xr LiQw== X-Forwarded-Encrypted: i=1; AJvYcCWNnaskhmcZbrhdJdgFnA7OmEI9EAP92pTbhmjBKnDxy6cxBDcHW6dmr7pDgCzysMpMG4y5ERdIdBkqDquBTMSpIMJnUfoerjbxuG9AkukVUFXeMRM= X-Gm-Message-State: AOJu0YwDTShTaJnlvbnuPB3tbsbvn9jtxIFbeW+a1X09qx8AQksHgCpY ZkO/ABVEjlu2ByV2oZab7A9AzMbTuBVKnarky1AOb+RNpHhBQd1cTXzuez5HG6exWsJJMwuyGbc hF4nG1m7UWWIDcjtQZ7z98HDL2sB1don0ZRZlGG8Iu7x/LxzR8NQO1QGRPCB694UB3mUaLoOy X-Received: by 2002:a05:6870:911f:b0:221:9798:22ce with SMTP id o31-20020a056870911f00b00221979822cemr1235675oae.5.1709880630969; Thu, 07 Mar 2024 22:50:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IF5WJ4Hs7BOa4+cQmkVKBMn/KDqWDXIuEQmCh9SbFC/cz4o3SLGxNN1BrH2AJEolH8ck0I8Eg== X-Received: by 2002:a05:6870:911f:b0:221:9798:22ce with SMTP id o31-20020a056870911f00b00221979822cemr1235655oae.5.1709880630429; Thu, 07 Mar 2024 22:50:30 -0800 (PST) Received: from x1n ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id r37-20020a632065000000b005dcc075d5edsm13621982pgm.60.2024.03.07.22.50.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 22:50:30 -0800 (PST) Date: Fri, 8 Mar 2024 14:50:20 +0800 From: Peter Xu To: Jason Gunthorpe Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Andrew Morton , Muchun Song , Matthew Wilcox , Mike Rapoport , Christophe Leroy , x86@kernel.org, sparclinux@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Alistair Popple Subject: Re: [PATCH RFC 01/13] mm/hmm: Process pud swap entry without pud_huge() Message-ID: References: <20240306104147.193052-1-peterx@redhat.com> <20240306104147.193052-2-peterx@redhat.com> <20240307181233.GD9179@nvidia.com> MIME-Version: 1.0 In-Reply-To: <20240307181233.GD9179@nvidia.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240307_225036_505677_569BD15D X-CRM114-Status: GOOD ( 23.80 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Mar 07, 2024 at 02:12:33PM -0400, Jason Gunthorpe wrote: > On Wed, Mar 06, 2024 at 06:41:35PM +0800, peterx@redhat.com wrote: > > From: Peter Xu > > > > Swap pud entries do not always return true for pud_huge() for all archs. > > x86 and sparc (so far) allow it, but all the rest do not accept a swap > > entry to be reported as pud_huge(). So it's not safe to check swap entries > > within pud_huge(). Check swap entries before pud_huge(), so it should be > > always safe. > > > > This is the only place in the kernel that (IMHO, wrongly) relies on > > pud_huge() to return true on pud swap entries. The plan is to cleanup > > pXd_huge() to only report non-swap mappings for all archs. > > > > Cc: Alistair Popple > > Signed-off-by: Peter Xu > > --- > > mm/hmm.c | 7 +------ > > 1 file changed, 1 insertion(+), 6 deletions(-) > > Reviewed-by: Jason Gunthorpe > > > @@ -424,7 +424,7 @@ static int hmm_vma_walk_pud(pud_t *pudp, unsigned long start, unsigned long end, > > walk->action = ACTION_CONTINUE; > > > > pud = READ_ONCE(*pudp); > > - if (pud_none(pud)) { > > + if (pud_none(pud) || !pud_present(pud)) { > > Isn't this a tautology? pud_none always implies !present() ? Hmm yes I think so, afact, it should be "all=none+swap+present". I still remember I missed that once previously, it's not always obvious when preparing such patches. :( I'll simplify this and also on patch 3. Thanks, -- Peter Xu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel