From patchwork Wed Dec 19 03:40:44 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: 10736743 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 7AADC13AD for ; Wed, 19 Dec 2018 03:41:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 618D32B250 for ; Wed, 19 Dec 2018 03:41:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 519C62B254; Wed, 19 Dec 2018 03:41:12 +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 DF7B42B250 for ; Wed, 19 Dec 2018 03:41:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5A8F8E0004; Tue, 18 Dec 2018 22:41:05 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C0B848E0001; Tue, 18 Dec 2018 22:41:05 -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 AD3098E0004; Tue, 18 Dec 2018 22:41:05 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 50F448E0001 for ; Tue, 18 Dec 2018 22:41:05 -0500 (EST) Received: by mail-ed1-f72.google.com with SMTP id y35so14909730edb.5 for ; Tue, 18 Dec 2018 19:41:05 -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:mime-version:content-transfer-encoding:message-id; bh=WIj6EhR5vdBCUmtBBeR9ScyWanmW3YssNpvn/4+wvkc=; b=XkvyAwHe1Of7Oc1CUWXJQU75OUtJJmG8F12w3zcM80Hfbg0rL3v+/Q5gf0NxfJLyaV kc0v1m1mK1fLXag/U8CslpDsuKCmvKZtrgdouIXjRZuGU7f+o9f751xHIFvdOBd0YQXy ir1QvAKHal7U3UF1y6FrDO1FA9+AnlfiXmUufoLiyDFsWOlnlFamiigaS2wPE4+YP7dk lU3DWZ0ornRlhL1js3PS9AKkg5U/et+Gzmll5GfpCIQTrfHCqwnbhsUU7BYYBIKUS5Mx pvf8NWrPmLzYjXiOkmjQrc4Y9IL5jd6iliTyhJQ70fBIeCE7HYRuzsq7vNXndshDJk6b Ot+A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 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: AA+aEWZbUb82tvK8SFyI4hzC0EMLxwO9UdzSilff8MAVxYQiJ+Box3SZ ofz97A1cg6M2y935OOn1qxPM6WPatYK9k38CuLrwgEaWun36mkRPSgKtuTu4S1BgLNih14YNRAW Egju5NX0h9eq3Lqaf3hQfEhpUiZsUNO3y5AeWhJBh3PVtngH+kwZHKrpdvSwb7s+CYQ== X-Received: by 2002:a17:906:78c1:: with SMTP id r1-v6mr15044381ejn.150.1545190864810; Tue, 18 Dec 2018 19:41:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/VyYvWg2wUJaOpajyYylkIkUSMoz0WyWFbdcb9FKEA3LjXOUGGkF99EZvqc1wbqlkSjoA4A X-Received: by 2002:a17:906:78c1:: with SMTP id r1-v6mr15044352ejn.150.1545190863927; Tue, 18 Dec 2018 19:41:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545190863; cv=none; d=google.com; s=arc-20160816; b=0EAeJXJ3oUnRcXDYSp1iMtTkuvS6CFMpBqrWc3JfIjFJpdcKdVB+OSt0uWGJu3u4TV nTmf6AkxY1mD+0y5bGeVnLUxyd5Gv8DHts5W+kJjMhCtfZS8VISqPe/z1dYFYGnkj8En bbp3MN8eudluj0QC9GZuNo+SrNNz00JuMc2LOmMj874fCO1TxbxkM5rEYYQWEQTO3yag zKByih7Gruipptc7voBtl87OVe0tQrUtTNFO8wCNTs6au+qV/32deze2M51LOs9KKY6Y 3WSes4SXKblpU+FKTEvYoIvdsazM2XXGYu1UppIZaIk25RZ4OLmbam7wJCxyP0IwZ6Ia BpFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:content-transfer-encoding:mime-version:date:subject:cc :to:from; bh=WIj6EhR5vdBCUmtBBeR9ScyWanmW3YssNpvn/4+wvkc=; b=o/FO4j1UDS0XBkD35TBUTaesWTF6uEYO6K0BlmzFyC64PWWhiDiWRyr+qDqWXISUts IkKHEaPwq2ioqMmNPzQ+0DWgzwuI3WPpyWAeYjK029M4Lj5n/ZaPXw9RhjqR+C+0sOy+ m6OEM9TH3tRdcseCTxkQZp496dJVW/uIl/EHLdKek7aMbh80DRDatmFRx0LtggzB6hVT S/865l64PJcIThXozHfqLw4F9MrJIXhoiwVo2tZ8kJfsxHuZ3qHVyBRSLwh8gzkA0KIM c9LxmIf/BBzRdV2DTBKyTFtxlykyJrK5Cxw1BiE6ktmgevuXGZ4IFdCJH+L6D8Y5vhqd O77Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 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 (mx0b-001b2d01.pphosted.com. [148.163.158.5]) by mx.google.com with ESMTPS id ca21-v6si853934ejb.96.2018.12.18.19.41.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Dec 2018 19:41:03 -0800 (PST) Received-SPF: pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) client-ip=148.163.158.5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 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 (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wBJ3dL0B040254 for ; Tue, 18 Dec 2018 22:41:02 -0500 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0b-001b2d01.pphosted.com with ESMTP id 2pfbj4p08u-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 18 Dec 2018 22:41:02 -0500 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 19 Dec 2018 03:41:01 -0000 Received: from b03cxnp08028.gho.boulder.ibm.com (9.17.130.20) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 19 Dec 2018 03:40:57 -0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wBJ3eujp26935388 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 19 Dec 2018 03:40:56 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BFED67805E; Wed, 19 Dec 2018 03:40:56 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 158BB78060; Wed, 19 Dec 2018 03:40:52 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.85.71.103]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 19 Dec 2018 03:40:52 +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 V5 0/3] mm/kvm/vfio/ppc64: Migrate compound pages out of CMA region Date: Wed, 19 Dec 2018 09:10:44 +0530 X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18121903-0004-0000-0000-000014C46FB0 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010246; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000271; SDB=6.01133803; UDB=6.00589449; IPR=6.00913978; MB=3.00024741; MTD=3.00000008; XFM=3.00000015; UTC=2018-12-19 03:40:59 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18121903-0005-0000-0000-000089E8D859 Message-Id: <20181219034047.16305-1-aneesh.kumar@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-19_02:,, 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=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=557 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812190029 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, 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 V4: * use __GFP_NOWARN when allocating pages to avoid page allocation failure warnings. 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 | 139 +++++++++++++++++++++++++++ 5 files changed, 186 insertions(+), 102 deletions(-)