From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2471C433DB for ; Wed, 17 Feb 2021 17:26:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7F7FE64E33 for ; Wed, 17 Feb 2021 17:26:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F7FE64E33 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EF3B36B006E; Wed, 17 Feb 2021 12:26:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E7C716B0070; Wed, 17 Feb 2021 12:26:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF5B46B0071; Wed, 17 Feb 2021 12:26:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id B24E56B006E for ; Wed, 17 Feb 2021 12:26:18 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6E0B18249980 for ; Wed, 17 Feb 2021 17:26:18 +0000 (UTC) X-FDA: 77828438436.02.pies77_08019902764e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 52CD210097AA0 for ; Wed, 17 Feb 2021 17:26:18 +0000 (UTC) X-HE-Tag: pies77_08019902764e X-Filterd-Recvd-Size: 6124 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Wed, 17 Feb 2021 17:26:17 +0000 (UTC) Received: by mail-pg1-f176.google.com with SMTP id o7so8920121pgl.1 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=lqdnLgSNQ/bsO/jvyfS5Sakx+ubywfjWsKQb//2MGVTNeXPEzmIcQWKl/Dv1rSUDCH +w3QhhFtXuGjKaqDOlHJvGunV0hMaDqBamRJ/BiNHQ7Z2gHl7RoE8g/mrZVJfoFWN0fw gOsAA8vjdkETvky9FLgkjElndB/N6olbvmx0Fs9dXKU0zxprFmwyI9aPXME4vFCxxpBo W6YWH7KbPm6YJCfgLyfxvJFq48yt6URNp33ky/AjTw+b0e2nnk1ZyVIStc9YqXGQcfa/ jU5qvB3I+cclqIeEhoV2YUFqcByay9IDVID0Qry+D3MHg3vBp5Bl7gD2BC8IHfsem230 YhIA== X-Gm-Message-State: AOAM532/uVFHxDYF5yKz+M38G//Z13e954Oe/yUmGE+ak7wpafGOkgBi kd+1PUtaaFJNB3R+lDgwU1Y= X-Google-Smtp-Source: ABdhPJzcCx5TjtY9QiP5moYJdajoHlLBG0k7JaeWbjVqS2qr7d7Ja4wpluAoYn2+kxfSgY+hjh3dAQ== 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) 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> 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: 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.