From patchwork Mon Jan 14 09:54:32 2019 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: 10761847 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 3B4B213B5 for ; Mon, 14 Jan 2019 09:54:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0A4128AD0 for ; Mon, 14 Jan 2019 09:54:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B390928ADD; Mon, 14 Jan 2019 09:54:53 +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 10F3928AD0 for ; Mon, 14 Jan 2019 09:54:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C0058E0003; Mon, 14 Jan 2019 04:54:52 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2702B8E0002; Mon, 14 Jan 2019 04:54:52 -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 1620C8E0003; Mon, 14 Jan 2019 04:54:52 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by kanga.kvack.org (Postfix) with ESMTP id E26398E0002 for ; Mon, 14 Jan 2019 04:54:51 -0500 (EST) Received: by mail-qt1-f199.google.com with SMTP id z6so23968322qtj.21 for ; Mon, 14 Jan 2019 01:54:51 -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=WWlzmHmq5iFG7ucWqh/yQ7vpUIA4L+31EP4Nq4FCVx4=; b=CH2xxE2rXI7VZqTCyttlQhPECeBYx4QTpcohv+fvIXHvV4tW0s2CjbnSmPTXN3O7yh cmba4xiERhKhkmIj/ql4VJCp7t0XqZhtH8HeW9qQd2nGpRB7+3QWy2s0PDLbC5CUS2vS isX8UhsZgPa2oma8KWdrtIPatTpVYIRDtL+UoGhyTMio5u42ZWWetOI9xEsf8hT8RwiM O4afOlFoKLWRkcPi6rLnfUnlqRgD2MmjTfcrnjLGznf11Pk+os8kZkLplWE1YdqPY3vX 696U1kWDFVLQlWI5FSjN6tnoa77CY0BIuGUjlaqSlASe0mVgLf66K27JyqaK6L98gxT5 pfEw== 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: AJcUukdLuEVeMc09PHvRbUWiOO3IGBwEfmxfQh3JKtsJDqxMIAt7dqWH xZCPIbg549/u8NaGp67U7N/QjXnX+R83kyQ4LkpN7Lflvj1WHKcMRvu6TMVJcFTUfd7zQ7oIxsQ xn/jd/BS84E5VhF7A5KrSPswracv3AaIYmRoxCCM0YcfUEo7sJL1s9VIOgH5MxF95nw== X-Received: by 2002:a37:5bc1:: with SMTP id p184mr22454474qkb.121.1547459691615; Mon, 14 Jan 2019 01:54:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN6uslVz9u7ZE2Bnv73DjFS8RnZsDEHgZWykT1wE7TFK1/RN6+Px1rg5RDTPRhoL373cHgJ1 X-Received: by 2002:a37:5bc1:: with SMTP id p184mr22454443qkb.121.1547459690864; Mon, 14 Jan 2019 01:54:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547459690; cv=none; d=google.com; s=arc-20160816; b=IX9XEomJtW5me957W17lLf8obSwK5azdZlThsQFF2VKBvR6SFPsa16jgp0a7tuV5hF 1dzZFiHrptPX77VkM+7EFg4G3SLR5Gc/N3zm5esEOiNSuF03Dys/l2hMNuLb8mGZUlPa FSKMw78kilCotnGAOCQZzE1r79UXyaKK6InnXSBXW5wMqwLgjF5/ahjcHTHto9JW3sdD gHxxAZgfesnXrdfH0AtYGDFX3x18oxbnN19glmUd7NUwnFAN73ypWJig7Eray58AFsbN cN/rDnJX6tllc2Oe44+DK6nXZDE4ZBz2uxwbPa8ZAMbiumTDJkC7kxJtSrodQ+0jb+4K eI7w== 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=WWlzmHmq5iFG7ucWqh/yQ7vpUIA4L+31EP4Nq4FCVx4=; b=Zk/Y6MSqRx1X27j59MNd3AwZkAgjxCNaEFOdgeyusqmL47igyl5AsdJbJeIbrvNxqY XlJZfuvONt2f3k4LZYY4qJvgaL8AoavcX2RAyXgzE7MXebV2W0QiFszSwCEubL/2fLyZ GoI4rb/WlX8878mSeM2Q5+ye6SV4E/Vei4XpZ7MbV8eWxE5/VeN8HH7KmJffTb8Amv+O yOMTwvraEqVefK4qM1SEkaK4G4NTEl6q/e4jsR+gREHaFNQuzYGAgoDOWnymW1bRes/K qvE4U7DxydTIthNYA+sbFYSj83pkEcb9pPNW6O6i/LL4dqiOC+n1s5guJLqxEF63Oexs kIBA== 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 l13si2641803qtq.121.2019.01.14.01.54.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 01:54:50 -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 (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x0E9mhlb011886 for ; Mon, 14 Jan 2019 04:54:50 -0500 Received: from e15.ny.us.ibm.com (e15.ny.us.ibm.com [129.33.205.205]) by mx0b-001b2d01.pphosted.com with ESMTP id 2q0kw2t31v-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 14 Jan 2019 04:54:50 -0500 Received: from localhost by e15.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 14 Jan 2019 09:54:49 -0000 Received: from b01cxnp22033.gho.pok.ibm.com (9.57.198.23) by e15.ny.us.ibm.com (146.89.104.202) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 14 Jan 2019 09:54:46 -0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0E9sjA524903800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 14 Jan 2019 09:54:45 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8635CAE063; Mon, 14 Jan 2019 09:54:45 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 138DAAE066; Mon, 14 Jan 2019 09:54:43 +0000 (GMT) Received: from skywalker.in.ibm.com (unknown [9.124.31.106]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 14 Jan 2019 09:54:42 +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 V7 0/4] mm/kvm/vfio/ppc64: Migrate compound pages out of CMA region Date: Mon, 14 Jan 2019 15:24:32 +0530 X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19011409-0068-0000-0000-000003825C2E X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010402; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000274; SDB=6.01146284; UDB=6.00597007; IPR=6.00926570; MB=3.00025118; MTD=3.00000008; XFM=3.00000015; UTC=2019-01-14 09:54:49 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011409-0069-0000-0000-000047206E1C Message-Id: <20190114095438.32470-1-aneesh.kumar@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-14_05:,, 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=747 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901140081 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. Changes from V6: * use get_user_pages_longterm instead of get_user_pages_cma_migrate() 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: Update get_user_pages_longterm to migrate pages allocated from CMA region powerpc/mm/iommu: Allow migration of cma allocated pages during mm_iommu_do_alloc powerpc/mm/iommu: Allow large IOMMU page size only for hugetlb backing arch/powerpc/mm/mmu_context_iommu.c | 146 ++++++-------------- include/linux/hugetlb.h | 2 + include/linux/mm.h | 3 +- include/linux/sched.h | 1 + include/linux/sched/mm.h | 48 +++++-- mm/gup.c | 200 ++++++++++++++++++++++++---- mm/hugetlb.c | 4 +- 7 files changed, 267 insertions(+), 137 deletions(-)