Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp989003ybt; Wed, 8 Jul 2020 17:29:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/4RuH/2p15lyFcZuPGHXbvmN8NszIOVO9ydH/Ai2TRv+V7by6Tb0O77KGU+bbx4PmQ4HN X-Received: by 2002:a05:6402:c82:: with SMTP id cm2mr59988815edb.293.1594254541302; Wed, 08 Jul 2020 17:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594254541; cv=none; d=google.com; s=arc-20160816; b=wJGASqtcLSbQaA1HiUeQGARO0eGCOPwUexNsnGwdaFOvD42bhkOA1driYqrqLXO6Ws Ly4CYNsZfp4yaaOzkzQXadEqLbiBGcXCRsZk0wE+Sr+g8TQqb81ir6/FY7vphJbCjbza cjeOUQUu/j2J7olOqc7LBGpYZhfzq3p1sBt47BOZN5kpdzBC6BfevLaCQdyJlO45fqU7 Yxue9xPfdp+TclmCXAfkr6pPOvWQnriA1AAqkVEhWRUZDuWNPkkHC5xIcqBBKT1EDYBQ bfRiq+p91TPiMswcu3ob+slhjqM1yyYuOZhRvOYeJcOIR9wwfUR+7RnUevIMbTWcaq0d U2KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=9wTlfNWUhlBkv+3kQoqpAPAkBwg2Ychc+A1txd54KuU=; b=zlOMuSkL/DB9obJlyU6CbbsI7EbdNUv+/ArNVArV8OyqA28j9OiwdicVuAOAbQT/lC ckTWlnEZUdI2qX6Iayalv9VGt832VQHgJPM8xDLdLsO/okaINvcz9NvdhmYGBphbjIC0 itcVpV7agMpM0swziiCkeuVW3H8iN/6bH4HSArf0NjSrL0DcnDUv4pvGM9TtT2G3eDzP +7WNIOdYe166+8aoyrSWIQ+z30L9zx9U+7Hsy/1iQt4agUAUgWiv7kcwo2Ei0ftScQaB jqI+HsBkyHpyKArgMyeiqfKGMybN9s/cWtHi+6spC4XoyqKDC0DzZJPhyzgvVHoaEuRR 6j4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=vVxCjmLY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e5si875333ejb.453.2020.07.08.17.28.38; Wed, 08 Jul 2020 17:29:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=vVxCjmLY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726140AbgGIA21 (ORCPT + 99 others); Wed, 8 Jul 2020 20:28:27 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:48470 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726072AbgGIA20 (ORCPT ); Wed, 8 Jul 2020 20:28:26 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0690H2wh050436; Thu, 9 Jul 2020 00:27:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=9wTlfNWUhlBkv+3kQoqpAPAkBwg2Ychc+A1txd54KuU=; b=vVxCjmLY1DJD+ZYztlW4afOBJx4N3WOMrod3i7UV9opN5Na3qUH6t6IwRovloNxd+oR7 5XdpVgit8DYh4N8vkmBF90jD07Saqr6UZN2D1T+x9zjOWBBHHyhnUNtDKJk+rN1REqPd JT6LJen/FND+EBq1vUOu8Eon8rsC7i67vvBmyR9jmLwbb/FavgU8toGcPk7awCsx4xCu Ia6oxZk7X/pgDFjwRkfXvuS1BQZqQtVsoERYKEVgrK6YdzpK995Q3GPmURE17sQ9l7+L oM3jL9bmkvrD8azhhWYR264bfZq+qtxwsg/KV0ehBh1aBAN8SEeCr9dxt3WWEX8hBZzw jA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 325k369j4j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 09 Jul 2020 00:27:33 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0690JGGa034775; Thu, 9 Jul 2020 00:27:33 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 325k3fxw3g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Jul 2020 00:27:33 +0000 Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0690ROtj016228; Thu, 9 Jul 2020 00:27:24 GMT Received: from [192.168.2.112] (/50.38.35.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 08 Jul 2020 17:27:23 -0700 Subject: Re: [PATCH v4 04/11] mm/hugetlb: make hugetlb migration callback CMA aware To: Joonsoo Kim , Vlastimil Babka Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@lge.com, Christoph Hellwig , Roman Gushchin , Naoya Horiguchi , Michal Hocko References: <1594107889-32228-1-git-send-email-iamjoonsoo.kim@lge.com> <1594107889-32228-5-git-send-email-iamjoonsoo.kim@lge.com> <20200708071602.GB16543@js1304-desktop> From: Mike Kravetz Message-ID: Date: Wed, 8 Jul 2020 17:27:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200708071602.GB16543@js1304-desktop> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9676 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 mlxscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007090000 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9676 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 impostorscore=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007090000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/8/20 12:16 AM, Joonsoo Kim wrote: > On Tue, Jul 07, 2020 at 01:22:31PM +0200, Vlastimil Babka wrote: >> On 7/7/20 9:44 AM, js1304@gmail.com wrote: >>> From: Joonsoo Kim >>> <...> >>> This patch makes the deque function on hugetlb CMA aware and skip CMA >>> pages if newly added skip_cma argument is passed as true. >> >> Hmm, can't you instead change dequeue_huge_page_node_exact() to test the PF_ >> flag and avoid adding bool skip_cma everywhere? > > Okay! Please check following patch. >> >> I think that's what Michal suggested [1] except he said "the code already does >> by memalloc_nocma_{save,restore} API". It needs extending a bit though, AFAICS. >> __gup_longterm_locked() indeed does the save/restore, but restore comes before >> check_and_migrate_cma_pages() and thus new_non_cma_page() is called, so an >> adjustment is needed there, but that's all? >> >> Hm the adjustment should be also done because save/restore is done around >> __get_user_pages_locked(), but check_and_migrate_cma_pages() also calls >> __get_user_pages_locked(), and that call not being between nocma save and >> restore is thus also a correctness issue? > > Simply, I call memalloc_nocma_{save,restore} in new_non_cma_page(). It > would not cause any problem. > > ------------------>8------------------- > From bcfc57e3c6f2df1ad2940308b89d740cd3f0fba8 Mon Sep 17 00:00:00 2001 > From: Joonsoo Kim > Date: Wed, 8 Jul 2020 14:39:26 +0900 > Subject: [PATCH] mm/hugetlb: make hugetlb migration callback CMA aware > <...> > > This patch makes new_non_cma_page() uses memalloc_nocma_{save,restore} > to exclude CMA memory rather than manually clearing __GFP_MOVABLE. And, > this patch also makes the deque function on hugetlb CMA aware. In the > deque function, CMA memory is skipped if PF_MEMALLOC_NOCMA flag is set > by memalloc_nocma_{save,restore}. > > Acked-by: Mike Kravetz > Signed-off-by: Joonsoo Kim I did ACK the previous version of the patch, but I like this much better. I assume there will be a new version built on top of Michal's patch to change the placement of memalloc_nocma_restore calls in __gup_longterm_locked. -- Mike Kravetz