Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3044236ybt; Mon, 29 Jun 2020 13:46:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJye0ac7Q+dxnHf91uxuuO2//eVaB0bIi25bRgACiKzhQDbLwg3kk/QoFDbmkx7qPDO7HVA+ X-Received: by 2002:a17:906:3889:: with SMTP id q9mr16507762ejd.318.1593463611269; Mon, 29 Jun 2020 13:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593463611; cv=none; d=google.com; s=arc-20160816; b=FHr61LJQFldgnKjbuuVb6jjAZHYMWmMD8y684eRMngFK46DeOYaBqIdXf6dbwuXzR3 6/Wiygmy37IF4P1rwcvDA11Txr04fbDUJFbZefFBUXogjcgPCVyswIayGEZCiieoVTdb WGAas/eBTmcb49S8uhlyLJ4pTyYpmgEMjwxBH0Yedam5D3jI0GvJFVmMpTV5bkoNKLht /BJJ1AR8y/MWBgC/wJqjVl45FukqgT7V/mCOxXGykgRnAbTBKPvefaBvBuDKTNz4nUyn mfNvV12vqQFDLz/QeRRzHZQ5AK96R0+nhR2fJXqffQGM1suYNE5J2vzMIIjpZVUplf1I 9mkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Go+MGAqswQJ5Or7swZG3YdRuz2dFng+SdQlnF5u8UcY=; b=k5bll/Boh4rtoMsQ7fGB4mp5G3i/3WFex4aC1w+50Pp5lnTd1MG23J+LYwIvJzb71m EoSbtx8jbU5I91WYXEjSEzVt87/xd4nZWLFg6lw1vJMborLomC/AlEdr5yf6pmK3xnXk jfaGw4w3fUqOeyS/FJV2n+dZyd0zIjtIx1B3vgs10l9P2q8HMrNqTM307/M0v2ZJKl01 pRqab3japqmoxptDhJoe8qnHnQdBPaLrUP2PCo86KhNCQJ7DBsYen5/Oj7uS7pXSsQka T2I+H/95S2dIfhzTITVnmWPMxml+e5HL6+WnGutfSqTzopEjgBu+zv4L97Nsyatxs53Z SX9w== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p2si311228edr.239.2020.06.29.13.46.28; Mon, 29 Jun 2020 13:46:51 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730756AbgF2UnR (ORCPT + 99 others); Mon, 29 Jun 2020 16:43:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731634AbgF2TOD (ORCPT ); Mon, 29 Jun 2020 15:14:03 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF8F6C014AF7 for ; Mon, 29 Jun 2020 00:55:13 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id h28so12019959edz.0 for ; Mon, 29 Jun 2020 00:55:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Go+MGAqswQJ5Or7swZG3YdRuz2dFng+SdQlnF5u8UcY=; b=TrqZ78o6Lo7TxTA2f1Zw4bEtjp8PnlDTD8K4yPHe3LbvzdYRpokNRybEi1GB30yqvq InxvSRGZRUiJLvfCSj8Db1AoQQlW/apw9JprEJ1aGVWPTfpETjKGE7A8RlLyCyRBizGx 8gwVumpmiAf1SlnW9MdUWid6Z4bjno3iMLckR3ZjKTap5+ISTAm7ilbnLz469BvWQnbX rGNPfDyQAlRc1iftjquNIBfLqsER8jBsBb3xcwJlp4AJD2zB0/Y4NZP/Ztv4CJCPwffq iv2hKTPOOJJez0ALBrjWzNA4bmOgQlbrvy6kRB8ksr86u3rxCXpeBFld9OuZdaYeUSFS IOgw== X-Gm-Message-State: AOAM532vTScIu7yoJSCnkz4WLiuljXrFwXw8vWBUXkbDsuxGjJChk7/X RPNxqchXPX6kcKYxojyGwmU= X-Received: by 2002:a50:b086:: with SMTP id j6mr13392527edd.6.1593417312217; Mon, 29 Jun 2020 00:55:12 -0700 (PDT) Received: from localhost (ip-37-188-168-3.eurotel.cz. [37.188.168.3]) by smtp.gmail.com with ESMTPSA id g22sm2606486eds.67.2020.06.29.00.55.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 00:55:11 -0700 (PDT) Date: Mon, 29 Jun 2020 09:55:10 +0200 From: Michal Hocko To: Joonsoo Kim Cc: Andrew Morton , Linux Memory Management List , LKML , kernel-team@lge.com, Vlastimil Babka , Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , Joonsoo Kim Subject: Re: [PATCH v3 4/8] mm/hugetlb: make hugetlb migration callback CMA aware Message-ID: <20200629075510.GA32461@dhcp22.suse.cz> References: <1592892828-1934-1-git-send-email-iamjoonsoo.kim@lge.com> <1592892828-1934-5-git-send-email-iamjoonsoo.kim@lge.com> <20200625115422.GE1320@dhcp22.suse.cz> <20200626072324.GT1320@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 29-06-20 15:27:25, Joonsoo Kim wrote: [...] > Solution that Introduces a new > argument doesn't cause this problem while avoiding CMA regions. My primary argument is that there is no real reason to treat hugetlb dequeing somehow differently. So if we simply exclude __GFP_MOVABLE for _any_ other allocation then this certainly has some drawbacks on the usable memory for the migration target and it can lead to allocation failures (especially on movable_node setups where the amount of movable memory might be really high) and therefore longterm gup failures. And yes those failures might be premature. But my point is that the behavior would be _consistent_. So a user wouldn't see random failures for some types of pages while a success for others. Let's have a look at this patch. It is simply working that around the restriction for a very limited types of pages - only hugetlb pages which have reserves in non-cma movable pools. I would claim that many setups will simply not have many (if any) spare hugetlb pages in the pool except for temporary time periods when a workload is (re)starting because this would be effectively a wasted memory. The patch is adding a special case flag to claim what the code already does by memalloc_nocma_{save,restore} API so the information is already there. Sorry I didn't bring this up earlier but I have completely forgot about its existence. With that one in place I do agree that dequeing needs a fixup but that should be something like the following instead. diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 57ece74e3aae..c1595b1d36f3 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1092,10 +1092,14 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask, /* Movability of hugepages depends on migration support. */ static inline gfp_t htlb_alloc_mask(struct hstate *h) { + gfp_t gfp; + if (hugepage_movable_supported(h)) - return GFP_HIGHUSER_MOVABLE; + gfp = GFP_HIGHUSER_MOVABLE; else - return GFP_HIGHUSER; + gfp = GFP_HIGHUSER; + + return current_gfp_context(gfp); } static struct page *dequeue_huge_page_vma(struct hstate *h, If we even fix this general issue for other allocations and allow a better CMA exclusion then it would be implemented consistently for everybody. Does this make more sense to you are we still not on the same page wrt to the actual problem? -- Michal Hocko SUSE Labs