Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4650453imu; Tue, 18 Dec 2018 20:15:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vb+OMGEPoIGqunmxZZIqnp/WslukmIYdZAD7JenZgLzsZQSne02H63rQGVWgUnjhmmEHUn X-Received: by 2002:a63:4819:: with SMTP id v25mr17478285pga.308.1545192949817; Tue, 18 Dec 2018 20:15:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545192949; cv=none; d=google.com; s=arc-20160816; b=LN2wGAWSGnlUwI/Ez+9cxjLdFo2eUA/4ygUzRxHOndSwwKDB20r0QPPxlBFpCb3hAW Iwu3uKMsUSsB+Dxt0MmPbW/IBxCb4rf6NCVz3jFB6Cvmc30a4iZRUEOijpSaQ5AmXPmN b9ApFMvNTw97uda7QcCikRW7nI89lZl4zKIKblAxkUWAT7AU1V+vUMtr5AklQABovDFI nwYC/8JlAXV5g6tDexngoNUQ0r9qqavzgi5r1vGoQBOAPdjyy6ILbXRi6EdyXFBQOni0 0XyhqOBs6zLgAo6ysgRYOueiWH/ZwLPyv4Xw1de+F0y/xMwiQzKDqyb88NinXFbCEafK PcGg== 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=WIj6EhR5vdBCUmtBBeR9ScyWanmW3YssNpvn/4+wvkc=; b=zyO+UkeiTfQrQQhc9pUWlCVRQXhvvSF59L7z9mAS1v3A76/eZnqRUSJhvrYJ5FgQRP dP7ewvvZnsT8SZwuKref6i5Dnvt5L6wsEWpokU1jkYGGTJ0F5AvIvAS2QCWalIup4BI6 aW+yJmrj0OTRK+yfkPdimauFZnNgUQVMvoV8rTH0X5xxxG1MNkvBkX/xB7wmKJBlXaXn e51AkF2CYF4ti5t/ATPlZAiqYh3xbOZtwFfuzCMzR9DlF9XY1XM5nNzaUQ62bG3q1Lmo 98dJMlOQrKFR85cuc8cCe/SRIR+W+ouTv8Oot9GJGmmCv2N1XXanMyt4kAwN33is2Exh 8VZw== 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 c64si15057510pfg.239.2018.12.18.20.15.33; Tue, 18 Dec 2018 20:15:49 -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 S1727189AbeLSDlD (ORCPT + 99 others); Tue, 18 Dec 2018 22:41:03 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:60620 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726537AbeLSDlD (ORCPT ); Tue, 18 Dec 2018 22:41:03 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wBJ3dMC5021719 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 2pfc1p52eh-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 Content-Transfer-Encoding: 8bit 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=559 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812190029 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 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(-) -- 2.19.2