From patchwork Fri Aug 19 10:12:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 12948680 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 6D07AC32771 for ; Fri, 19 Aug 2022 10:14:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 07DE78D0003; Fri, 19 Aug 2022 06:14:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 02DB68D0002; Fri, 19 Aug 2022 06:14:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E5F4F8D0003; Fri, 19 Aug 2022 06:14:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D58568D0002 for ; Fri, 19 Aug 2022 06:14:21 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id A2A62160958 for ; Fri, 19 Aug 2022 10:14:21 +0000 (UTC) X-FDA: 79815932322.30.B8B7921 Received: from out199-14.us.a.mail.aliyun.com (out199-14.us.a.mail.aliyun.com [47.90.199.14]) by imf01.hostedemail.com (Postfix) with ESMTP id 4BFE0400E2 for ; Fri, 19 Aug 2022 10:13:08 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R981e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VMfr8eo_1660903984; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VMfr8eo_1660903984) by smtp.aliyun-inc.com; Fri, 19 Aug 2022 18:13:05 +0800 From: Baolin Wang To: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com Cc: baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/3] Fix some issues when looking up hugetlb page Date: Fri, 19 Aug 2022 18:12:55 +0800 Message-Id: X-Mailer: git-send-email 1.8.3.1 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660903990; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=4T5YWokFKJomyNM6WCqWpJRXVddvuGMi/j1YaRVZHC4=; b=fpKRrUJgIx7zje8+lzuEZjtsk3OVJovlqwifaBJPgHqHjCRasp9m3RyBtvajkuQDwtxhGT PKeup3KHwgNrDfUN73oAiEDwueu77fp7dGfz+hlYc1bUbUwwJ/xmVdqIa3jv+PIhK9p+lE 5P8KebIwxIHzW8mvbNNp871FIEgzL1c= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf01.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 47.90.199.14 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660903990; a=rsa-sha256; cv=none; b=AlaErraxU92I4CHiZojZ4eHtPO1pkgfJ3dDrgGx3geWO4/MIINmh5q9bxwg4nCNi/zG/Tq bLrvAMtPHm//qJ1GH8jo1PiCJsAgkmXU+9P4z2ToKX+fGzO4MgiVa+LLsDcJqmAgwBz2U2 yffCSyMF19KphEnCXqWzdjmhGxl/mSI= Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf01.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 47.90.199.14 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 4BFE0400E2 X-Stat-Signature: zickueqsh9bi3ybiwwwejmd1i3h61586 X-Rspam-User: X-HE-Tag: 1660903988-539587 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: Hi, On ARM64 architecture, it can support CONT-PTE/PMD size hugetlb. When looking up hugetlb page by follow_page(), we will hold the incorrect pte/pmd lock for the CONT-PTE/PMD size hugetlb page, which will make the pte/pmd entry unstable even under the lock and cause some potential race issues. So considering the CONT-PTE/PMD size hugetlb, this patch set changes to use the correct function to get the correct pte/pmd entry lock to make the pte/pmd entry stable. Baolin Wang (3): mm/gup: fix races when looking up a CONT-PTE size hugetlb page mm/hugetlb: fix races when looking up a CONT-PMD size hugetlb page mm/hugetlb: add FOLL_MIGRATION validation before waiting for a migration entry include/linux/hugetlb.h | 4 ++-- mm/gup.c | 24 +++++++++++++++++++++--- mm/hugetlb.c | 17 ++++++++++++++--- 3 files changed, 37 insertions(+), 8 deletions(-)