Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1446408pxj; Fri, 4 Jun 2021 14:54:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwQRliVSMkI3GBQsVynq7x6qqi9KGG5e3H7KMUQewYgakW/mFnrCl1IU+36ugxS+VNEl8V X-Received: by 2002:a05:6402:50d1:: with SMTP id h17mr7208181edb.199.1622843697104; Fri, 04 Jun 2021 14:54:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622843697; cv=none; d=google.com; s=arc-20160816; b=gf5nBlCSebU/0CZ6apkJFUmT5uyzyrhSIQh/8kZGV1w55KCgoPnkmxmFi8kyjHSIMh TfbhZmFTi2t7PCjUYvBXs6qXDlwWj878YxIlO7/DXjoFjH692iUHmGpZ2JfBC4RzuI+a tJCIFx58n8tCRpFmRAJnQKr2nXnkGP3aDVkQD/1D5O+52u2ruDWpmhQpmjfs9beeC1mK k/UiqGDleIHsEK+CqsX7er4s4qKyekqu9W58ypS8ar9OItuzW+BKdGYygnjZvh6E3IwB 3gUa7XSarSmjHgR8Sj0LxKZqW0TRuVFbUfOWb4t7NFr+Il26gIRWYn46hseptWMaNTzl 2EZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=5ALgaqHb4Ps4FEwMFfNaWGSDMjcH3JF+dL8YdWEXIPU=; b=Wp1wCI/tdlkhamfsCxZ9wNRA8ROXdz/P80naWbRVBbkF4Z5I7bHiLRoDhuKjqTaQDw LNe8xfQT2oRCjFBGB2Fj8nq2E/XLRLR4vPmxRY5irfu8UAYt+GcaFBoBaEtiJHmpppqI SCT9iE5djgCk63rZygjPgF24j2r3jEAiVElKcfQaPVHWLDWyeoM/jIL06njRp67XeLKe 3h9txZU9SJlVz5ox7G/ZyFaxV4JXVSk/nrH7ZogxHvrvK/txKFs2RKE9a05Zzq04abf2 zizfz+0BHtUlKDjUhpTlym65t+NpajjWgkshmx+fmuHE0guU0wDWED0/XE3tRxaTAgJE GpTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hwbq82k9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hh4si6095780ejb.79.2021.06.04.14.54.34; Fri, 04 Jun 2021 14:54:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hwbq82k9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S231393AbhFDVzQ (ORCPT + 99 others); Fri, 4 Jun 2021 17:55:16 -0400 Received: from mail-qk1-f176.google.com ([209.85.222.176]:46804 "EHLO mail-qk1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229930AbhFDVzQ (ORCPT ); Fri, 4 Jun 2021 17:55:16 -0400 Received: by mail-qk1-f176.google.com with SMTP id 76so10796171qkn.13 for ; Fri, 04 Jun 2021 14:53:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=5ALgaqHb4Ps4FEwMFfNaWGSDMjcH3JF+dL8YdWEXIPU=; b=hwbq82k9vMgWFKloVlJ2XlYpNE6rWAmJsCAvCH1RcWEFw1WWNXtuikZXcPE4SzmqXw RqkKYab5vj6MNgQoLiUWDhJLjnj1C3ZcWIPXDdBytN+3zTtFjp7JRK1+RgQX7+hRXz9O RThWudmiBRFZUvFzZqZfSCsE9Gs06Z9EOqRfahuqGxCEqF7KuWt6slPLsvIga7KxRdMW JPOk37kTve0uV88/+36KtMnNHoGqRfddzQBEGUTSnjQvU6/M8BFUdX+jIzWJbKeppH+7 grmIJJu3TQDh0hQmrTpomqz4mgdGr7LWktmw5X6GkhXEdikSuoZ3jFi34e0A6NZ2z8ET C7EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=5ALgaqHb4Ps4FEwMFfNaWGSDMjcH3JF+dL8YdWEXIPU=; b=o500axQlnw/7lAkHmEL+94npuxUR4vJvB1N2K5Xm2dBBsPSiVbc/JF492yySyBQ6YS kIpaZX7aylxHLHslUDtS0FMyXbNPCY6KTs1HXI3pakX0l8Yre5StlkaB/b+naGc4tFPG Aok5lza3hjee0D340+NDVXFGFhsoMJEta8xrNLvxCmfGN8EyL7gS0n6QDj5CHQvE9soi g1yY6cqRgTIZxTgSBH9Y4DqKdbaoUUE4LpL1O5IBHXcOvmtXoMQZYQz730XLK5yXaWXm Wyki4TTGeeWhzNCRbkVW2Lh5nb3sZa5Ehu7YbkfUiFNzVwKdHzgejpWZJCm1VeiGyFjD kJuQ== X-Gm-Message-State: AOAM532J8UzTTRYR0ogVGclldHBSmM3HHfyW+OoIlPXyJt6d0g8JaMfi sOXrIEL0DxUXg4L6+gGs35Hiew== X-Received: by 2002:a37:8507:: with SMTP id h7mr6224742qkd.277.1622843532434; Fri, 04 Jun 2021 14:52:12 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id f13sm4728423qkk.107.2021.06.04.14.52.10 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Fri, 04 Jun 2021 14:52:12 -0700 (PDT) Date: Fri, 4 Jun 2021 14:52:09 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Yang Shi cc: Hugh Dickins , Andrew Morton , "Kirill A. Shutemov" , Wang Yugui , Matthew Wilcox , Naoya Horiguchi , Alistair Popple , Ralph Campbell , Zi Yan , Miaohe Lin , Minchan Kim , Jue Wang , Peter Xu , Jan Kara , Linux MM , Linux Kernel Mailing List Subject: Re: [PATCH 1/7] mm/thp: fix __split_huge_pmd_locked() on shmem migration entry In-Reply-To: Message-ID: References: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 4 Jun 2021, Yang Shi wrote: > On Thu, Jun 3, 2021 at 7:23 PM Hugh Dickins wrote: > > On Thu, 3 Jun 2021, Yang Shi wrote: > > > On Tue, Jun 1, 2021 at 2:05 PM Hugh Dickins wrote: > > > > The point here (see commit message above) is that some unrelated pmd > > migration entry could pass the is_huge_zero_pmd() test, which rushes > > off to use pmd_page() without even checking pmd_present() first. And > > most of its users have, one way or another, checked pmd_present() first; > > but this place and a couple of others had not. > > Thanks for the elaboration. Wondering whether we'd better add some > comments in the code? Someone may submit a fix patch by visual > inspection in the future due to missing these points. I don't really want to add a comment on this, there in zap_huge_pmd(): I think it would be too much of a distraction from that dense code sequence. And the comment will be more obvious in the commit message, once I split these is_huge_zero_pmd() fixes off from __split_huge_pmd_locked() as Kirill asked. But... now I think I'll scrap these parts of the patch, and instead just add a pmd_present() check into is_huge_zero_pmd() itself. pmd_present() is quick, but pmd_page() may not be: I may convert it to use a __read_only huge_pmd_pfn, or may not: I'll see how that goes. Hugh