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=-14.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 6001FC433E0 for ; Tue, 29 Dec 2020 21:23:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D897021D1B for ; Tue, 29 Dec 2020 21:23:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D897021D1B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2FD798D0040; Tue, 29 Dec 2020 16:23:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 285E38D002C; Tue, 29 Dec 2020 16:23:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1013A8D0040; Tue, 29 Dec 2020 16:23:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0253.hostedemail.com [216.40.44.253]) by kanga.kvack.org (Postfix) with ESMTP id E7C5C8D002C for ; Tue, 29 Dec 2020 16:23:53 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id AEEA1181AEF0B for ; Tue, 29 Dec 2020 21:23:53 +0000 (UTC) X-FDA: 77647597146.03.road02_51038922749f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 92E2E28A4E8 for ; Tue, 29 Dec 2020 21:23:53 +0000 (UTC) X-HE-Tag: road02_51038922749f X-Filterd-Recvd-Size: 4035 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Tue, 29 Dec 2020 21:23:53 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id E96FB2074B; Tue, 29 Dec 2020 21:23:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1609277032; bh=RxQOQuf1Y+ttZzPNxwEdSK4WRKnL6B6y/lEz6gysaUA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lzoh8IKgzoFFAs+0T/a7Yr+aA2fYNzSEUOgK43NfytqD5LjxvCjmnJdtPC9M7B3V1 keLX6X2QKaQ6SgCtbr728CYh5HB/BtyVjXiIShy2J07n5Sa566lJsLTcT6n5aPKcTo QbwcHoE8HfioRMEIkyjJhd9FD0iVgDdT/rC9FhfA= Date: Tue, 29 Dec 2020 13:23:51 -0800 From: Andrew Morton To: Hailong liu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, liu.hailong6@zte.com.cn Subject: Re: [PATCH] mm/page_alloc:add a missing mm_page_alloc_zone_locked tracepoint Message-Id: <20201229132351.025362ec38b0a763340a82de@linux-foundation.org> In-Reply-To: <20201228132901.41523-1-carver4lio@163.com> References: <20201228132901.41523-1-carver4lio@163.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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: On Mon, 28 Dec 2020 21:29:01 +0800 Hailong liu wrote= : > The trace point *trace_mm_page_alloc_zone_locked()* in __rmqueue() does= not > currently cover all branches. Add the missing tracepoint and check the = page > before do that. >=20 > ... > > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -2871,7 +2871,7 @@ __rmqueue(struct zone *zone, unsigned int order, = int migratetype, > zone_page_state(zone, NR_FREE_PAGES) / 2) { > page =3D __rmqueue_cma_fallback(zone, order); > if (page) > - return page; > + goto out; > } > #endif > retry: > @@ -2884,8 +2884,9 @@ __rmqueue(struct zone *zone, unsigned int order, = int migratetype, > alloc_flags)) > goto retry; > } > - > - trace_mm_page_alloc_zone_locked(page, order, migratetype); > +out: > + if (page) > + trace_mm_page_alloc_zone_locked(page, order, migratetype); > return page; > } Looks right to me, but it generates a warning. Using IS_ENABLED() works around it. From: Andrew Morton Subject: mm-page_alloc-add-a-missing-mm_page_alloc_zone_locked-tracepoint= -fix use IS_ENABLED() to suppress warning mm/page_alloc.c: In function =E2=80=98__rmqueue=E2=80=99: mm/page_alloc.c:2889:1: warning: label =E2=80=98out=E2=80=99 defined but = not used [-Wunused-label] out: ^~~ Cc: Hailong liu Signed-off-by: Andrew Morton --- mm/page_alloc.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) --- a/mm/page_alloc.c~mm-page_alloc-add-a-missing-mm_page_alloc_zone_lock= ed-tracepoint-fix +++ a/mm/page_alloc.c @@ -2862,20 +2862,20 @@ __rmqueue(struct zone *zone, unsigned in { struct page *page; =20 -#ifdef CONFIG_CMA - /* - * Balance movable allocations between regular and CMA areas by - * allocating from CMA when over half of the zone's free memory - * is in the CMA area. - */ - if (alloc_flags & ALLOC_CMA && - zone_page_state(zone, NR_FREE_CMA_PAGES) > - zone_page_state(zone, NR_FREE_PAGES) / 2) { - page =3D __rmqueue_cma_fallback(zone, order); - if (page) - goto out; + if (IS_ENABLED(CONFIG_CMA)) { + /* + * Balance movable allocations between regular and CMA areas by + * allocating from CMA when over half of the zone's free memory + * is in the CMA area. + */ + if (alloc_flags & ALLOC_CMA && + zone_page_state(zone, NR_FREE_CMA_PAGES) > + zone_page_state(zone, NR_FREE_PAGES) / 2) { + page =3D __rmqueue_cma_fallback(zone, order); + if (page) + goto out; + } } -#endif retry: page =3D __rmqueue_smallest(zone, order, migratetype); if (unlikely(!page)) { _