Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6754403pxb; Wed, 17 Feb 2021 12:30:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPlXh88wCjz38K7YRlxzMNhIMXBpfVmksHF2uk9yKMQABzZU4VOM4XtkBGy2IfbJlLGoRt X-Received: by 2002:a17:906:7fc4:: with SMTP id r4mr676044ejs.81.1613593844342; Wed, 17 Feb 2021 12:30:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613593844; cv=none; d=google.com; s=arc-20160816; b=SuVhvTIYheR1b2S+x77lWwhRApQaKbYcOgPfYsb6eL6M1DjhCxr/XoHDqjGl3AgDAQ rv20vTuOZBG9gGVGCJv3ueFE/ZYLoEa6r8zxu+l1ykg5l49O/hlTPAmpKKIbdKCYB0B4 nEJKboEO4axCDoUmoiiBAWEyoyENY6GgmE16SAFCSLBCSOquut1sM2zQ2ZzaltdJBOGW a7tGhCRMtOf8VpyGnyTjKvmYc9kairHsM/z5/yk2cayl7fRcpd4YMCGj+cnQvvOsak2r 8POXs1HDCK8e09M+mOvF0PI9pfdP3pn7FJLIMw9oRFGEzVZIEjFz+f0E54CoQX4ZwfS4 1IDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=KfJENNomm0u1yDPE/3P/mDju/zU9mlMVzfZQ10n5yXs=; b=FqQ3ylr9bxoy3EGY0mqn1Wi1CLSCu1D+BFMrYHMIqhm6yQbo7e8pwHmqAs1+CAEBXk hjjEClXWXyj2QX30+2Uumg3QsspXBUBYlu587ZXuqt+94RIyReIB/kRgWPs3ccbGRgfl qrpoqVQ9x45t6vY54/cPMFSYG1JnLWYOaJ52b+mK7Nqu+1qYLpQykAm3gYn4NbexkszO EFGHtnpB2oqZ8BVZM3FBhkgKtNI3BsicUCGTeVKyk+kYocO3PrS8KE8uS1vd7h1C7tmm iGqOhFYgJCJt1gMMyYMZyC+nNpEzO4LtXvFFeJ41Lq816EKpOAwqk50NG9wV1nSHH0+q 48ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Fmjf3a9z; 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 cf10si2236573ejb.701.2021.02.17.12.30.19; Wed, 17 Feb 2021 12:30:44 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=Fmjf3a9z; 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 S234410AbhBQR07 (ORCPT + 99 others); Wed, 17 Feb 2021 12:26:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231978AbhBQR05 (ORCPT ); Wed, 17 Feb 2021 12:26:57 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75B0EC0613D6 for ; Wed, 17 Feb 2021 09:26:17 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id x136so8859720pfc.2 for ; Wed, 17 Feb 2021 09:26:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KfJENNomm0u1yDPE/3P/mDju/zU9mlMVzfZQ10n5yXs=; b=Fmjf3a9zfQSt5m5VVLr9vi0HB78rGgbfHbSrkmZDE2X4oMN+4CiJuZuucPqOTlb8VK f6pafPewDu81KXRlsmQpevZR+d5x6F4uCugBw78bXlAz/+gEMu5JPSAVg2qkSOs41bP1 3m3Lsgep9ryRq3ua/jK5z+w2loFjnzkzuV53xUR39UElHCxR36qlonpT85KCaZTPOHjg af4zEiFw1yYoFEKGDu8V6NlOiI/QPs+ADvtLdSkxFqPUvH/xMU/qJyRvSu5zv+XS6NYl +iWM1xEtFFCzuYHYThNcUi+fHwktaKm7vLZELYV7wC7Z4+ZYyq8ftbea8DAZZFTj9BRN Wz8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=KfJENNomm0u1yDPE/3P/mDju/zU9mlMVzfZQ10n5yXs=; b=MDrOq8ln+bcBLT5I7hA7AjrLlk8PmzzRLd+tGqARezbFCfK7kGwVEkQ9X/BZKW0E9H 4BY3aSAamnopj2/ME0Qnx2NVJWL5Pjys+xnu9d6unxSulM6q+O2tCt0/IX/k1wnZhPGK focUPPfAFRUIOz1eAX8ddIA/rY2AGUMqHUUP/gGCbyjWPZJ/ITKeIo54GNjkForKfuQN uTy33qFQ5/PAJoX/tchNQqUEJA6c0OgYbfhveyu+RksHfpea3J79CJCIVHoxpONiax+E xEFa+Q+qQbKghOfP2LKbBDrli3eB6v8vA8u06KuteJzd6elIWjXpswNTiXq1qjbQqesH ZpvQ== X-Gm-Message-State: AOAM533sUU1R17S36A5YiKZg1ZHa05Fzgz4IMNWmfmg8QKW059ILTXl5 Nn17DTzL9Z0h4PkvBq7On5c= X-Received: by 2002:a63:da4a:: with SMTP id l10mr393986pgj.222.1613582776967; Wed, 17 Feb 2021 09:26:16 -0800 (PST) Received: from google.com ([2620:15c:211:201:cdf7:1c5d:c444:e341]) by smtp.gmail.com with ESMTPSA id m6sm2797216pjg.39.2021.02.17.09.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 09:26:15 -0800 (PST) Sender: Minchan Kim Date: Wed, 17 Feb 2021 09:26:14 -0800 From: Minchan Kim To: David Hildenbrand Cc: Andrew Morton , linux-mm , LKML , mhocko@suse.com, joaodias@google.com Subject: Re: [PATCH] mm: be more verbose for alloc_contig_range faliures Message-ID: References: <20210217163603.429062-1-minchan@kernel.org> <854d4ec8-1eb9-3595-b867-3e50f5a0e6a8@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <854d4ec8-1eb9-3595-b867-3e50f5a0e6a8@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 17, 2021 at 05:51:27PM +0100, David Hildenbrand wrote: > On 17.02.21 17:36, Minchan Kim wrote: > > alloc_contig_range is usually used on cma area or movable zone. > > It's critical if the page migration fails on those areas so > > dump more debugging message like memory_hotplug unless user > > specifiy __GFP_NOWARN. > > > > Signed-off-by: Minchan Kim > > --- > > mm/page_alloc.c | 16 +++++++++++++++- > > 1 file changed, 15 insertions(+), 1 deletion(-) > > > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > > index 0b55c9c95364..67f3ee3a1528 100644 > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -8486,6 +8486,15 @@ static int __alloc_contig_migrate_range(struct compact_control *cc, > > NULL, (unsigned long)&mtc, cc->mode, MR_CONTIG_RANGE); > > } > > if (ret < 0) { > > + if (!(cc->gfp_mask & __GFP_NOWARN)) { > > + struct page *page; > > + > > + list_for_each_entry(page, &cc->migratepages, lru) { > > + pr_warn("migrating pfn %lx failed ret:%d ", > > + page_to_pfn(page), ret); > > + dump_page(page, "migration failure"); > > + } > > This can create *a lot* of noise. For example, until huge pages are actually > considered, we will choke on each end every huge page - and might do so over > and over again. I am not familiar with huge page status at this moment but why couldn't they use __GFP_NOWARN if they are supposed to fail frequently? > > This might be helpful for debugging, but is unacceptable for production > systems for now I think. Maybe for now, do it based on CONFIG_DEBUG_VM. If it's due to huge page you mentioned above and caller passes __GFP_NOWARN in that case, couldn't we enable always-on? Actually, I am targeting cma allocation failure, which should be rather rare compared to other call sites but critical to fail. If it's concern to emit too many warning message, I will scope down for site for only cma allocation. > > > + } > > putback_movable_pages(&cc->migratepages); > > return ret; > > } > > @@ -8728,6 +8737,8 @@ struct page *alloc_contig_pages(unsigned long nr_pages, gfp_t gfp_mask, > > pfn = ALIGN(zone->zone_start_pfn, nr_pages); > > while (zone_spans_last_pfn(zone, pfn, nr_pages)) { > > if (pfn_range_valid_contig(zone, pfn, nr_pages)) { > > + unsigned long gfp_flags; > > + > > /* > > * We release the zone lock here because > > * alloc_contig_range() will also lock the zone > > @@ -8736,8 +8747,11 @@ struct page *alloc_contig_pages(unsigned long nr_pages, gfp_t gfp_mask, > > * and cause alloc_contig_range() to fail... > > */ > > spin_unlock_irqrestore(&zone->lock, flags); > > + > > + if (zone_idx(zone) != ZONE_MOVABLE) > > + gfp_flags = gfp_mask | __GFP_NOWARN; > > This feels wrong. It might be better to make that decision inside > __alloc_contig_migrate_range() based on cc->zone. CMA could be any normal zone and the suggestion will make it slient.