Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4976548iob; Mon, 9 May 2022 06:09:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMppCoNLmD/R2gFYP3eExh/srsK/RnFXpICIy8ORuBrWT3eBDbidfEFAyxHwpNKbstUx0a X-Received: by 2002:a17:902:e94e:b0:158:91e6:501 with SMTP id b14-20020a170902e94e00b0015891e60501mr16287896pll.29.1652101777186; Mon, 09 May 2022 06:09:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652101777; cv=none; d=google.com; s=arc-20160816; b=RGq47YvO5EjNp76eGW/N5/Spw+ihuoeViLDny3fX8pXI7InmLlSDUwHY0zFeliXvr/ S9tjptPKj9jmMn30ubtCeXJf4bXU0coWPNvgU00Jvd+CyyM3ynpYAu7cnzoM7HyJCyne 28AMcHe+R8p1rIv+6KlTmNMxhs2Qor3kK+N9Wo62Rf5Y+lDwLKdMGJFlUisa0OvkTLro Kj/oFbqeE+cEwTgmWrGSaJTUDhNxDt1ZFQ3EOBKCpVi0EadADRDj857pPFH4pBaZ+6pu jq4G55tfP/YQpuleIDv7frHxuCz7gP2jKQvrjJmMIiXF8kViW8LbGMJDznBWhv8R1dKr PnZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=weplSIyWyg+JT8G5ccdNAE8EfH8QQRj4TA+id+KKwRg=; b=WQ+wvpmgYmNJ7LBlb+fA59+nR1KLsI8IYdhN6WiB5wlP7fKgpYiwBnbPo0InZeNhOv u5XX8OflqHTWHkChRSvo8CwjxdRCtJH/JGsZkEAERN793udLPB31fUfIvGOA8YMYbeDa EqAQ/JzH1WLCWy2sHR4hJdFajle8kvbN4k62po+nGZzj8/2Jt1X2ohSZBhXIMeUz1SlE rAyeHXdPRHf8pQTO7sgG2NKRoMVfMpXVsizOGg8x6/SJKur9TV284Gmv8yDyH+ViyyyN lD1raHkQyF0bUl81iuVjW+OKBSawGLxcPsBRVIdu0I74GRbhQOymWw7sOCtzSzR0xxQV GbZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id n11-20020a170902d2cb00b0015d3604e495si13705281plc.165.2022.05.09.06.09.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 06:09:37 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DEAFA2A5E96; Mon, 9 May 2022 06:09:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235184AbiEINNA (ORCPT + 99 others); Mon, 9 May 2022 09:13:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235241AbiEINM6 (ORCPT ); Mon, 9 May 2022 09:12:58 -0400 Received: from outbound-smtp25.blacknight.com (outbound-smtp25.blacknight.com [81.17.249.193]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 347D82A5EB7 for ; Mon, 9 May 2022 06:09:00 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp25.blacknight.com (Postfix) with ESMTPS id 7B153CABF1 for ; Mon, 9 May 2022 14:08:59 +0100 (IST) Received: (qmail 18876 invoked from network); 9 May 2022 13:08:59 -0000 Received: from unknown (HELO morpheus.112glenside.lan) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPA; 9 May 2022 13:08:59 -0000 From: Mel Gorman To: Nicolas Saenz Julienne Cc: Marcelo Tosatti , Vlastimil Babka , Michal Hocko , LKML , Linux-MM , Mel Gorman Subject: [PATCH 4/6] mm/page_alloc: Remove unnecessary page == NULL check in rmqueue Date: Mon, 9 May 2022 14:08:03 +0100 Message-Id: <20220509130805.20335-5-mgorman@techsingularity.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220509130805.20335-1-mgorman@techsingularity.net> References: <20220509130805.20335-1-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The VM_BUG_ON check for a valid page can be avoided with a simple change in the flow. The ZONE_BOOSTED_WATERMARK is unlikely in general and even more unlikely if the page allocation failed so mark the branch unlikely. Signed-off-by: Mel Gorman --- mm/page_alloc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 4c1acf666056..dc0fdeb3795c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3765,17 +3765,18 @@ struct page *rmqueue(struct zone *preferred_zone, page = rmqueue_buddy(preferred_zone, zone, order, alloc_flags, migratetype); - if (unlikely(!page)) - return NULL; out: /* Separate test+clear to avoid unnecessary atomics */ - if (test_bit(ZONE_BOOSTED_WATERMARK, &zone->flags)) { + if (unlikely(test_bit(ZONE_BOOSTED_WATERMARK, &zone->flags))) { clear_bit(ZONE_BOOSTED_WATERMARK, &zone->flags); wakeup_kswapd(zone, 0, 0, zone_idx(zone)); } - VM_BUG_ON_PAGE(page && bad_range(zone, page), page); + if (unlikely(!page)) + return NULL; + + VM_BUG_ON_PAGE(bad_range(zone, page), page); return page; } -- 2.34.1