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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2B5EC04AA5 for ; Thu, 25 Aug 2022 07:10:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 607A3940007; Thu, 25 Aug 2022 03:10:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B6796B0075; Thu, 25 Aug 2022 03:10:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A7CF940007; Thu, 25 Aug 2022 03:10:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 39B086B0074 for ; Thu, 25 Aug 2022 03:10:47 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 0F9C5A4BBB for ; Thu, 25 Aug 2022 07:10:47 +0000 (UTC) X-FDA: 79837242534.14.6A1EC63 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 7502A1C0008 for ; Thu, 25 Aug 2022 07:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661411445; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gQTYhaP5ZnTyiRUCghuMXgfnJiby9YFa/3gZ89MmFuY=; b=hs3mVLHlk19lwncHRa4oMXVPEHjmcYicHEV/zrz+XQu2dTVnLnibUimZDFfNJC3twp7+jv LPgnCePdpeSP2Zl+WYqvjImz5V3EZ9CXDs2mJcyY/K6nNGpHjyKltRGn15p0+0w3YwC6UP AQSjboCvCdcojUlPvbUo5IQOoTcROJQ= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-661-arA5CTtGMwK-AgFVmgTOYw-1; Thu, 25 Aug 2022 03:10:44 -0400 X-MC-Unique: arA5CTtGMwK-AgFVmgTOYw-1 Received: by mail-wm1-f72.google.com with SMTP id ay21-20020a05600c1e1500b003a6271a9718so10293130wmb.0 for ; Thu, 25 Aug 2022 00:10:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc; bh=gQTYhaP5ZnTyiRUCghuMXgfnJiby9YFa/3gZ89MmFuY=; b=Bqsq8FvyK1ut3JF5ZxOqK0Bb1HXXmG2El6KMAcDIlDLpLTvrejZYU9x8jxi/ia08EE urss5bY+biltJobQISGcypvSM4l6izeflo/25d6EMDORm0lNgVWZMlxQhZBW1mRw+34l YQLDcf9Hydn1APxoFqfE/Ue1TpotubKOGd7QGknkXwoSf295oSjuG8Aw6wZu/8yj7bqq QcVW34ppxypO3k+5Trw+qaD6+XYu6c+/Q5nndXrjHv7yP9wplAYxfpGek2HI57IMKxRQ YUCk9VjIDx43HfWc7BtGfdPqdWwsTqUYGAabv+z2gy8WYSyxMxRQdjjALBw4ilSgAiO9 xo4w== X-Gm-Message-State: ACgBeo3zHNTtC04x4m27MF8pv5ZTRgnjN1FeHrhnYzTkb1Uv/0Cda2/R E/1JwUjkQd8a5Dvd5X2AIL2GD69+o4SczqVXTvdrE5wEynkdBYqwToqHPAcvBQ0M54gFEuUPkHd VYShc6SAwWQc= X-Received: by 2002:a05:600c:1593:b0:3a6:36fc:842f with SMTP id r19-20020a05600c159300b003a636fc842fmr1338398wmf.52.1661411443555; Thu, 25 Aug 2022 00:10:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR5XoJixQYfG32LnLM3/aYR9OzTmTQ041m8y1GB2FP9gmQ278aMA24LJl4o9WYJrTrHrm9yUsA== X-Received: by 2002:a05:600c:1593:b0:3a6:36fc:842f with SMTP id r19-20020a05600c159300b003a636fc842fmr1338376wmf.52.1661411443252; Thu, 25 Aug 2022 00:10:43 -0700 (PDT) Received: from ?IPV6:2a09:80c0:192:0:20af:34be:985b:b6c8? ([2a09:80c0:192:0:20af:34be:985b:b6c8]) by smtp.gmail.com with ESMTPSA id q3-20020a05600000c300b00225285b8136sm18377611wrx.38.2022.08.25.00.10.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Aug 2022 00:10:42 -0700 (PDT) Message-ID: <50703dda-bbee-7484-97ff-87d6ea75bf80@redhat.com> Date: Thu, 25 Aug 2022 09:10:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH v2 1/5] mm/hugetlb: fix races when looking up a CONT-PTE size hugetlb page To: Baolin Wang , Mike Kravetz Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <0e5d92da043d147a867f634b17acbcc97a7f0e64.1661240170.git.baolin.wang@linux.alibaba.com> <4c24b891-04ce-2608-79d2-a75dc236533f@redhat.com> <376d2e0a-d28a-984b-903c-1f6451b04a15@linux.alibaba.com> <7d4e7f47-30a5-3cc6-dc9f-aa89120847d8@redhat.com> <64669c0a-4a6e-f034-a15b-c4a8deea9e5d@linux.alibaba.com> <7ee73879-e402-9175-eae8-41471d80d59e@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661411446; a=rsa-sha256; cv=none; b=DBFMaxoNa30/W4mltDoZYRgCAasi9GY5pimxxbBYYo+gW30lmfBKnTY7PA+hz0Fo9UT9GU x6bO8tiD3WbnJnyhrvIkVu/epBl2+47PXDwZqekP3/4A2yaC/Lvaqqn9DmbO0HE2t2v/sj /C5+ltEh10N3TL5m/+9jcb19L7zbmds= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hs3mVLHl; spf=pass (imf21.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661411446; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gQTYhaP5ZnTyiRUCghuMXgfnJiby9YFa/3gZ89MmFuY=; b=LXYfwL/fzVu6bfEcVCr2frkDkWq8Q6iqFn2YuJ4xaOWR6NJ4hB66zZvlPwWnarRoWYSZMj f2mIeE0yBqI54u2xGhAZkFqSliIKddS1++OjSQPVIUAldaeApiFZjXCA9Y/ypgsisxhIqf qCi8crLWcKVPRx3u+yEPEydlFphHFgA= X-Stat-Signature: cweg66wsnu3srupawp8ubf84gtoxzyk3 X-Rspamd-Queue-Id: 7502A1C0008 X-Rspam-User: X-Rspamd-Server: rspam06 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hs3mVLHl; spf=pass (imf21.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1661411446-168254 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: >> + /* >> + * try_grab_page() should always succeed here, because we hold >> + * the ptl lock and have verified pte_present(). >> + */ >> + if (WARN_ON_ONCE(!try_grab_page(page, flags))) { >> + page = NULL; >> + goto out; >> + } >> + } else { > > Should add FOLL_MIGRATION validation before waiting a migration entry. We really only need FOLL_MIGRATION for KSM. As hugetlb pages cannot be KSM pages, we don't need this. Actually, I do have patches in the works that rip out FOLL_MIGRATION completely by adjusting KSM code. So let's try to not add dead code (although it would make sense for feature completeness as is -- but then, FOLL_MIGRATION really needs to go). -- Thanks, David / dhildenb