From patchwork Tue Aug 21 20:59:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Kravetz X-Patchwork-Id: 10572359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F6841390 for ; Tue, 21 Aug 2018 20:59:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F41B2AB6E for ; Tue, 21 Aug 2018 20:59:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 326652AB76; Tue, 21 Aug 2018 20:59:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8C382AB6E for ; Tue, 21 Aug 2018 20:59:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DB136B20AE; Tue, 21 Aug 2018 16:59:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4143D6B20B1; Tue, 21 Aug 2018 16:59:16 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 240A66B20AF; Tue, 21 Aug 2018 16:59:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ua1-f71.google.com (mail-ua1-f71.google.com [209.85.222.71]) by kanga.kvack.org (Postfix) with ESMTP id DAE216B20AF for ; Tue, 21 Aug 2018 16:59:15 -0400 (EDT) Received: by mail-ua1-f71.google.com with SMTP id t14-v6so8003800uao.6 for ; Tue, 21 Aug 2018 13:59:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=isJ9Jkdx665BY4ACGU8+ribFSSa0UcyNFfLuHxoM4Cs=; b=Oxb8dsfvLTCwVPhddwFPCySlfLhByObjVy6NpsdkUZfGwEJCxqS5YRC6y+XWnRU7pt vH9q/FHTB3Byf2R/qni2cpmjfSsOwsD6BEVsUt6EGoaerA7fyKBo304L3IBGD5tsi+rs M+T5xu5YXjDLjtCZZL8VWhdVA9oqf5xLRf8dGAXL+KqvRcbOTAk/gWO3Zu9hW3jsid/E rCFl1fNwvsyytIPm+Z3gKLgiGslbqxnv8SroSgZxHlh2J/5x6uMoi6HJ2v2tGnYyeK5k qM3c4mF97DqZjtg8msLEWeBc6SS87o+VP65UAkuWcdykwmeTF+TVqpRiZwBukLKAEQ64 5tqw== X-Gm-Message-State: AOUpUlExBT30CdEY8FM0Fgvxw3EG2ECzxVKg1L809q4eKkklX3DKm+8a 0BzXb9IR83ksnj9CRz7T6A+5CBZ7+oydT7E3BoS0j77huI9uD4cQUxgFGUJfKv32S14zDFxn9Jx B/LWt2+Y6kwA/F4sj58NrGrcNmsg9QZEXfs6Zv8LoTBU0YDq/uGXk1xMl0O6F1gnmPA== X-Received: by 2002:a1f:320b:: with SMTP id y11-v6mr34673119vky.25.1534885155525; Tue, 21 Aug 2018 13:59:15 -0700 (PDT) X-Google-Smtp-Source: AA+uWPy+KpgC4IwFPE9DwoEzTHsNMnPItTntbpIHVjky3D1t3eWRDYuVZCH0w+cZuMon5q+1zDbN X-Received: by 2002:a1f:320b:: with SMTP id y11-v6mr34673095vky.25.1534885154949; Tue, 21 Aug 2018 13:59:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534885154; cv=none; d=google.com; s=arc-20160816; b=ww0Qke2lrtRA6wOWemgQc1eEgdVE8ufi8qbX3VvAlKLA+OkQcy8WobKdCmCWeWfYgY xQwcQSA3hB9JE7W9eHPJAsvx1qUbIrqhKsbVyG4xfonKfbZs5CjzBtxnduL3EjyzjCsC hkmqyjjAXGYruNtuU5jcW0X4uXUKCO8tmcRO/H3RDSbVH84Wn9Ni83iD/PJHx0Q3iq3H OPFqddrZFNL5q4EFtapt2JQuteM/NIDWFt3kmHtbdDAUIWWLXsvnQwh1yiXFh6qwE8yG k6ZbUbjq7iKY1I2tbIeVDfvmBz34ZnWu+NztViU1keFbqbirD1jZPMG7PZwYUqQf2bIQ 2a7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=isJ9Jkdx665BY4ACGU8+ribFSSa0UcyNFfLuHxoM4Cs=; b=E+6A+7kWxkmXjS7KLar3ad3pNr43xA2Y5XUnzr6F+09EcxOEBqROIhSwu5rU4KSoHb 9W5NMpnlB2dOjn6ZcHD8ffJpo0X6zV9IFvStku5omBFxml2OTyQALuKjrUJcN8PcMZ+o v8Tl6hRV9FRfkKvizIgZe5u53ivexjyB9tpB1OmbZEloD2Bf/2Qw3otUK8QUp1wTa4Ud 8vrqqpHlJdQa+yz4e4Wo7gVl5AbZ/pIvXQW4vvBmDqYVkZoeLibaGzZctasCevsFjklV a3P0pJz7Wr0dPx5E41/A8jvIVHtQqrPDsN8n7m90vT/Ubvb5QYz/3MM/gMUmN6xyNUzt V/zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=SxfmEFda; spf=pass (google.com: domain of mike.kravetz@oracle.com designates 156.151.31.86 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from userp2130.oracle.com (userp2130.oracle.com. [156.151.31.86]) by mx.google.com with ESMTPS id 126-v6si5438891vkb.143.2018.08.21.13.59.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Aug 2018 13:59:14 -0700 (PDT) Received-SPF: pass (google.com: domain of mike.kravetz@oracle.com designates 156.151.31.86 as permitted sender) client-ip=156.151.31.86; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=SxfmEFda; spf=pass (google.com: domain of mike.kravetz@oracle.com designates 156.151.31.86 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w7LKvZsV032795; Tue, 21 Aug 2018 20:59:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2018-07-02; bh=isJ9Jkdx665BY4ACGU8+ribFSSa0UcyNFfLuHxoM4Cs=; b=SxfmEFdaPTtJBJrRAP8x7bnHqxL68JCqIBXJMKQ/JKO+VLugpt5XzZhBZC9W03NfyjJ8 OcAxkMdnzhnxwtaPx+rfK5B6ZhpPhHt72/wPIBTd8ezFv2vUAVJsBMYABMIGYtuCJK14 aQZGOx0nlrX5om9OvEWSEE1jKLQ7ZPdxwb+lE9JNJdPnsZriJ88j3mrbNVaMhG5aH6Rz NTE/r4tGVbYtkMUFDEEe8Hdf6fMuPCOYv8/x0uNlxloSz67dGqXm9zVSJcF8KzXfU4wD adwR5x/Ebq6mDnWUzJLI/r8wvGYoPIJb3ZZr29jL5l2ICQoZCjnWx9OI4e6TDV639Qk0 vA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2kxavtq5u3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Aug 2018 20:59:09 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w7LKx8U9032266 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Aug 2018 20:59:08 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w7LKx5TL015248; Tue, 21 Aug 2018 20:59:05 GMT Received: from monkey.oracle.com (/50.38.38.67) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 21 Aug 2018 13:59:05 -0700 From: Mike Kravetz To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: "Kirill A . Shutemov" , =?utf-8?b?SsOp?= =?utf-8?b?csO0bWUgR2xpc3Nl?= , Vlastimil Babka , Naoya Horiguchi , Davidlohr Bueso , Michal Hocko , Andrew Morton , Mike Kravetz Subject: [PATCH v3 0/2] huge_pmd_unshare migration and flushing Date: Tue, 21 Aug 2018 13:59:00 -0700 Message-Id: <20180821205902.21223-1-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.17.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8992 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=645 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808210212 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: X-Virus-Scanned: ClamAV using ClamSMTP v3 of a patch to correct a data corruption issue caused by improper handling of shared huge PMDs during page migration. This issue was observed in a customer environment and can be recreated fairly easily with a test program. Patch 0001 addresses this issue only and is copied to stable with the intention that this will go to stable releases. It has existed since the addition of shared huge PMD support. While considering the issue above, Kirill Shutemov noticed that other callers of huge_pmd_unshare have potential issues with cache and TLB flushing. A separate patch (0002) takes advantage of the new routine huge_pmd_sharing_possible() to adjust flushing ranges in the cases where huge PMD sharing is possible. There is no copy to stable for this patch as it has not been reported as an issue and discovered only via code inspection. Mike Kravetz (2): mm: migration: fix migration of huge PMD shared pages hugetlb: take PMD sharing into account when flushing tlb/caches include/linux/hugetlb.h | 14 +++++++ mm/hugetlb.c | 93 +++++++++++++++++++++++++++++++++++++---- mm/rmap.c | 42 +++++++++++++++++-- 3 files changed, 137 insertions(+), 12 deletions(-)