From patchwork Wed Nov 21 09:22:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 10692165 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 CAD1E13BB for ; Wed, 21 Nov 2018 09:23:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7A872B7FD for ; Wed, 21 Nov 2018 09:23:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB5F42B80C; Wed, 21 Nov 2018 09:23:15 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE 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 4BB5F2B7FD for ; Wed, 21 Nov 2018 09:23:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E71E36B256F; Wed, 21 Nov 2018 04:23:13 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DFB0B6B2570; Wed, 21 Nov 2018 04:23:13 -0500 (EST) 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 C9B656B2571; Wed, 21 Nov 2018 04:23:13 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by kanga.kvack.org (Postfix) with ESMTP id 7EF3D6B256F for ; Wed, 21 Nov 2018 04:23:13 -0500 (EST) Received: by mail-pl1-f199.google.com with SMTP id a9so6995720pla.2 for ; Wed, 21 Nov 2018 01:23:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=bg0b6sNHDckbIWyjo6IzFnjl9eu4udbancKY96RXbl8=; b=Tcwqe+uazZk4Z6zzqAWjDUuCy0BisAzZgBoeO2XFgQXm2Kvg15qzJdlfNG1bc953NV bqxGolQeHJeWzDOTRCEhU909zFaJJIx1xBq8DTHZ1fI59F2POY5bgHlAKd7ayIwkePOs WgfgZB8D+KaOVGBQEyl0R8KhwMpVpcDePRcC7j31GPqb2ZWnefZpXDhbQpNBgcmIads0 wbpWiv76emiuXZ0wdZgny+2aEjvORuC3iIuTFursOLJp4+ortebhw4+3ZpUju/OfZA/G RAxYl1mGRA5bgKHo2kL1VwdXJW7ilg6No2/6MrUP3VVuiiysw2GzjLVYhv5vPLmoJTDq aLNA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AGRZ1gLvlbGf6ekXCSojbUTDoNzOVC8u8YQtwFSgDlLBb39x/hHqD9nF 05kCS49VHaf1wBKgbeReU6+/bzcntaZyHhQdaWHcCZPyi1um+94N0QmDaKBnPz9f2Y+lOEkf4GB /NJh0mtn7dPNrBYYHMmkabpkMu2lB4HCBrmO4mOQvqQ1Jk4KX09bCOrKQ9lCduHNhHg== X-Received: by 2002:a62:8893:: with SMTP id l141mr5884536pfd.1.1542792193054; Wed, 21 Nov 2018 01:23:13 -0800 (PST) X-Google-Smtp-Source: AJdET5e16VBA9bjPR01nEVwnFLNr+fNRXDFvH1Wa5BM5LN/QQuaCVzLjlk6UEbYAeJ8MH+7HDIev X-Received: by 2002:a62:8893:: with SMTP id l141mr5884482pfd.1.1542792191977; Wed, 21 Nov 2018 01:23:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542792191; cv=none; d=google.com; s=arc-20160816; b=yMvMj4C0zhJ+kw+ve6iV9yrV5dgbhoJPx8+TjcS8gYTQiUfd8hEJaZFkhMiiA6J8SC w9bIKE4sGn3aCEjI1g+BR3Gl1M3mQQVs5fSMydqbMtuKoKx8bEWMK2Zb8XHFtm3XuKct iiCuqORInI+cqqcjpvc1SGfWE0ZYBCZ0JO6q6MUAN0y6bPxB9JwLgbhDJboZFqzVk0QY N2LamwrjcZ2Scn2JefpUF4scSkDKfmOcB9cxAdeIi69tsApD7cP+jsF4GUKbi7DKXkfk 3KFSB+OwBT2Znvmdb62PKCn3B2KU9Fcn3ntDYsL2ukyT3QPMfsqEUVYjaSVUb6WRWQhB Wsrg== 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; bh=bg0b6sNHDckbIWyjo6IzFnjl9eu4udbancKY96RXbl8=; b=H4JDCm56TSQOjfok1T4MYM9fV1O3Ih0Ez8XQIsC0V1u9fh2nbkonoQ572eaVUD3P8y kTOwXQqAbJVAIwpEnItt79HvPvbfj7dczSP3EZ8GhtovDSOXNcPgegQMqx64c37XIgPp bftM/OI91I6N0nNw/S/HG/iTs1BqzgI4ayeMllV2emN9DHDw1Iowmxwd5kpPOC3jauH0 Pzj+hZECDS4KPvxXadaKQ9Wj0v6MhC9/6z7zXNFxsvsdIoG9X59DE9FJLi7vz3vbeJUp ai6Z4Gj/bNiJnmbe583Pv4/lnazrCDT+CHckxBsSAm73BRPKWQkoyu7q5JlvnQQJBbq8 hcAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id a3si6664081pld.252.2018.11.21.01.23.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Nov 2018 01:23:11 -0800 (PST) Received-SPF: pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wAL9JbU6045445 for ; Wed, 21 Nov 2018 04:23:11 -0500 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nw0kgankf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 21 Nov 2018 04:23:10 -0500 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Nov 2018 09:23:09 -0000 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 21 Nov 2018 09:23:06 -0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wAL9N5sG27328582 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 21 Nov 2018 09:23:05 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 985BA124053; Wed, 21 Nov 2018 09:23:05 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2D5F3124055; Wed, 21 Nov 2018 09:23:03 +0000 (GMT) Received: from skywalker.in.ibm.com (unknown [9.124.31.179]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 21 Nov 2018 09:23:02 +0000 (GMT) From: "Aneesh Kumar K.V" To: akpm@linux-foundation.org, Michal Hocko , Alexey Kardashevskiy , mpe@ellerman.id.au, paulus@samba.org, David Gibson Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, "Aneesh Kumar K.V" Subject: [PATCH V4 0/3] * mm/kvm/vfio/ppc64: Migrate compound pages out of CMA region Date: Wed, 21 Nov 2018 14:52:56 +0530 X-Mailer: git-send-email 2.17.2 X-TM-AS-GCONF: 00 x-cbid: 18112109-0060-0000-0000-000002D6575A X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010092; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000270; SDB=6.01120588; UDB=6.00581487; IPR=6.00900709; MB=3.00024261; MTD=3.00000008; XFM=3.00000015; UTC=2018-11-21 09:23:09 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112109-0061-0000-0000-0000474465E8 Message-Id: <20181121092259.16482-1-aneesh.kumar@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-21_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=609 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811210085 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 ppc64 use CMA area for the allocation of guest page table (hash page table). We won't be able to start guest if we fail to allocate hash page table. We have observed hash table allocation failure because we failed to migrate pages out of CMA region because they were pinned. This happen when we are using VFIO. VFIO on ppc64 pins the entire guest RAM. If the guest RAM pages get allocated out of CMA region, we won't be able to migrate those pages. The pages are also pinned for the lifetime of the guest. Currently we support migration of non-compound pages. With THP and with the addition of hugetlb migration we can end up allocating compound pages from CMA region. This patch series add support for migrating compound pages. The first path adds the helper get_user_pages_cma_migrate() which pin the page making sure we migrate them out of CMA region before incrementing the reference count. Changes from V3: * Move the hugetlb check before transhuge check * Use compound head page when isolating hugetlb page Aneesh Kumar K.V (3): mm: Add get_user_pages_cma_migrate powerpc/mm/iommu: Allow migration of cma allocated pages during mm_iommu_get powerpc/mm/iommu: Allow large IOMMU page size only for hugetlb backing arch/powerpc/mm/mmu_context_iommu.c | 140 ++++++++-------------------- include/linux/hugetlb.h | 2 + include/linux/migrate.h | 3 + mm/hugetlb.c | 4 +- mm/migrate.c | 132 ++++++++++++++++++++++++++ 5 files changed, 179 insertions(+), 102 deletions(-)