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=-10.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 259CBC433DB for ; Thu, 4 Mar 2021 17:23:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 96E9B64F59 for ; Thu, 4 Mar 2021 17:23:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96E9B64F59 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 182D46B0023; Thu, 4 Mar 2021 12:23:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 10D8D6B0024; Thu, 4 Mar 2021 12:23:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA39B6B0025; Thu, 4 Mar 2021 12:23:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0023.hostedemail.com [216.40.44.23]) by kanga.kvack.org (Postfix) with ESMTP id C486B6B0023 for ; Thu, 4 Mar 2021 12:23:23 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 0C43399B5 for ; Thu, 4 Mar 2021 17:23:23 +0000 (UTC) X-FDA: 77882863086.03.36F8B74 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf16.hostedemail.com (Postfix) with ESMTP id 8D323801A80F for ; Thu, 4 Mar 2021 17:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614878598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+Q+msirUjwPNJ/6VeaFJuWexxOMnxBOOZp0eEWINW9s=; b=U1J5qZ8/glNdqPl9yc6xQooJWnWm0o5TF+d9BLz0uqeVut1w+5diyOlllAFj7Bfu6vmIVD IoMa88bl/Ypjtl5cicHImGjVIeVL1wUJdaBcm3RSmu0WLRXUlhcg0BW+JNzsDdCkcYosG6 LlyRRWuI95UOhrA1hnpnfUbKerW45p8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-597-W1S7B9z3NiaqN7idFXyDmQ-1; Thu, 04 Mar 2021 12:23:14 -0500 X-MC-Unique: W1S7B9z3NiaqN7idFXyDmQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8814057; Thu, 4 Mar 2021 17:23:12 +0000 (UTC) Received: from [10.36.113.171] (ovpn-113-171.ams2.redhat.com [10.36.113.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7ADC41002393; Thu, 4 Mar 2021 17:23:10 +0000 (UTC) To: Minchan Kim Cc: Michal Hocko , Andrew Morton , linux-mm , LKML , joaodias@google.com References: <2f167b3c-5f0a-444a-c627-49181fc8fe0d@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Subject: Re: [PATCH] mm: be more verbose for alloc_contig_range faliures Message-ID: Date: Thu, 4 Mar 2021 18:23:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 8D323801A80F X-Stat-Signature: 6mfcehfsejmfzu1if8qgfp441ajcgg4q Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf16; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614878598-451931 Content-Transfer-Encoding: quoted-printable 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: >> You want to debug something, so you try triggering it and capturing de= bug >> data. There are not that many alloc_contig_range() users such that thi= s >> would really be an issue to isolate ... >=20 > cma_alloc uses alloc_contig_range and cma_alloc has lots of users. > Even, it is expoerted by dmabuf so any userspace would trigger the > allocation by their own. Some of them could be tolerant for the failure= , > rest of them could be critical. We should't expect it by limited kernel > usecase. Assume you are debugging allocation failures. You either collect the=20 data yourself or ask someone to send you that output. You care about any=20 alloc_contig_range() allocation failures that shouldn't happen, don't you= ? >=20 >> >> Strictly speaking: any allocation failure on ZONE_MOVABLE or CMA is >> problematic (putting aside NORETRY logic and similar aside). So any su= ch >> page you hit is worth investigating and, therefore, worth getting logg= ed for >> debugging purposes. >=20 > If you believe the every alloc_contig_range failure is problematic Every one where we should have guarantees I guess: ZONE_MOVABLE or=20 MIGRAT_CMA. On ZONE_NORMAL, there are no guarantees. > and there is no such realy example I menionted above in the world, > I am happy to put this chunk to support dynamic debugging. > Okay? >=20 > +#if defined(CONFIG_DYNAMIC_DEBUG) || \ > + (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_M= ODULE)) > +static DEFINE_RATELIMIT_STATE(alloc_contig_ratelimit_state, > + DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); > +int alloc_contig_ratelimit(void) > +{ > + return __ratelimit(&alloc_contig_ratelimit_state); > +} > + ^ do we need ratelimiting with dynamic debugging enabled? > +void dump_migrate_failure_pages(struct list_head *page_list) > +{ > + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, > + "migrate failure"); > + if (DYNAMIC_DEBUG_BRANCH(descriptor) && > + alloc_contig_ratelimit()) { > + struct page *page; > + > + WARN(1, "failed callstack"); > + list_for_each_entry(page, page_list, lru) > + dump_page(page, "migration failure"); Are all pages on the list guaranteed to be problematic, or only the=20 first entry? I assume all. > + } > +} > +#else > +static inline void dump_migrate_failure_pages(struct list_head *page_l= ist) > +{ > +} > +#endif > + > /* [start, end) must belong to a single zone. */ > static int __alloc_contig_migrate_range(struct compact_control *cc, > unsigned long start, unsigned = long end) > @@ -8496,6 +8522,7 @@ static int __alloc_contig_migrate_range(struct co= mpact_control *cc, > NULL, (unsigned long)&mtc, cc->mode, M= R_CONTIG_RANGE); > } > if (ret < 0) { > + dump_migrate_failure_pages(&cc->migratepages); > putback_movable_pages(&cc->migratepages); > return ret; > } >=20 >=20 If that's the way dynamic debugging is configured/enabled (still have to=20 look into it) - yes, that goes into the right direction. As I said=20 above, you should dump only where we have some kind of guarantees I assum= e. --=20 Thanks, David / dhildenb