Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4317925imu; Mon, 7 Jan 2019 20:52:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN7l4DZJ5CD4TReI5Fn+5XiIJkEQKgOAV4RCi1d4paAiYFRIFEglI6HqwXUgfOwFj3lwTjWp X-Received: by 2002:a63:6604:: with SMTP id a4mr269910pgc.118.1546923166750; Mon, 07 Jan 2019 20:52:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546923166; cv=none; d=google.com; s=arc-20160816; b=AhZPX5VqUmdMbQScddWXzTnYlLERo3gq7Ljf6WPvJqDZbGfAHFFoDF+6nylwerQkWA Qul7y0n2Pbcb8A4z/zjcpFMGOJs75ymAWRm6MAhYhwtGIw4gs37IeGSk6BM4fdEZJH8P TdoU68hgtzeCUpR/hbAgjVvHpHCnaTWVmjnZk0AW9CJ1ZkCaxqgWcOPoXpebC7A+0WVa eXakDrH2IqT602NFBmz6+rW1eYJxOo3zj+4KyvLY2t8HWokqoPoQFsbRJctmjAhIOOlp epMGDERilquc9LhsPuikhjwW4eyekhUKehsWtlu1u5PBj3I7UEJCc/3rFe1VApt9vHH+ O71g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:date:subject:cc:to:from; bh=gVTaV3tpIBiESn6+ZG0iItHArjg6M3t6FGAh0QXUO+M=; b=OvjrWckBFiR/hdrVp3U5VADRoExEScs7GbSk7jHq5un2TUMW1coS3p+K2D5ndvP+E1 N6QWPQ5fpcUNbjfr1U2AMecMa0aCD1nZvx5O4eu4t6N504XtLvHMOaosyYFy6GcJOACE AIZUQ2QzvN9G4yzaeNfarpBwjVKrI4ROhzLhdrhhqkUEy3W6PyBxFZ4fYHosa5Jg1pxJ U80l0oeKuq9ObsFeKKlYWbIzw1M+SgW4p4+EGpdzPaCCjlRMYzEdOYadtwzhFGojFUiX epdnl2E/Ltkie3JbPqGPSG4WsvveWsKeIxNkrZmNq913VHhiOP1OfbnXoTyoZdv6BbLu rnKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g22si74435610pfj.222.2019.01.07.20.52.31; Mon, 07 Jan 2019 20:52:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727608AbfAHEv0 (ORCPT + 99 others); Mon, 7 Jan 2019 23:51:26 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51686 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727368AbfAHEv0 (ORCPT ); Mon, 7 Jan 2019 23:51:26 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x084muWV089809 for ; Mon, 7 Jan 2019 23:51:25 -0500 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2pvf8kqr4n-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 07 Jan 2019 23:51:24 -0500 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 Jan 2019 04:51:23 -0000 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 8 Jan 2019 04:51:20 -0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x084pJ7717760430 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 8 Jan 2019 04:51:19 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3E0DCB205F; Tue, 8 Jan 2019 04:51:19 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A8E80B2065; Tue, 8 Jan 2019 04:51:15 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.85.75.199]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 8 Jan 2019 04:51:15 +0000 (GMT) From: "Aneesh Kumar K.V" To: akpm@linux-foundation.org, Michal Hocko , Alexey Kardashevskiy , David Gibson , Andrea Arcangeli , mpe@ellerman.id.au Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, "Aneesh Kumar K.V" Subject: [PATCH V6 0/4] mm/kvm/vfio/ppc64: Migrate compound pages out of CMA region Date: Tue, 8 Jan 2019 10:21:06 +0530 X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19010804-0064-0000-0000-000003923AFD X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010364; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000273; SDB=6.01143337; UDB=6.00595222; IPR=6.00923595; MB=3.00025025; MTD=3.00000008; XFM=3.00000015; UTC=2019-01-08 04:51:22 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19010804-0065-0000-0000-00003BF2E2C6 Message-Id: <20190108045110.28597-1-aneesh.kumar@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-08_03:,, 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=702 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901080036 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 V5: * Add PF_MEMALLOC_NOCMA * remote __GFP_THISNODE when allocating target page for migration 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 (4): mm/cma: Add PF flag to force non cma alloc 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 | 144 ++++++++------------------- include/linux/hugetlb.h | 2 + include/linux/migrate.h | 3 + include/linux/sched.h | 1 + include/linux/sched/mm.h | 36 +++++-- mm/hugetlb.c | 4 +- mm/migrate.c | 149 ++++++++++++++++++++++++++++ 7 files changed, 227 insertions(+), 112 deletions(-) -- 2.20.1