Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4135061pxb; Mon, 1 Feb 2021 13:26:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJza3tqLyjTWs8f9trsDB3PXB4L68EkPRX532tIo6AbFPDNzdxjrxcdoTZccAkgZLZXkblg7 X-Received: by 2002:a05:6402:160f:: with SMTP id f15mr20914063edv.348.1612214812876; Mon, 01 Feb 2021 13:26:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612214812; cv=none; d=google.com; s=arc-20160816; b=hAlhECfpR60VUb0m5A4G2gi1u5y0yyHXGLXE6fNvSziP/T7OqokDRU7dlc8UbtKck2 U9ef8CFNOempbTTomNeveo8H2pRWvEAYn47aZ3+axATqsQHugjf1bTTjTfX4RXcYLIaZ Rbp225XHUr1WLS4F1EF3Phc/xuDV99JPxuMFV0wzd5qJdFklamaRAso4bv2v869HxZkp Q11ZhC2gHg37ksK/24tLtKAmL0bNhBbBQeOeOMGCiBH1OI9i5cv5vqU5tXsNKVGF6r8V HjmW/iLa4btHDaTOlmDI9f9UluMQ4juEop44zuKA2PfzYt1hkjeWMnOe2NqT4IH1BIIW vDiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=Stmza4ZljYVmGoBag2te1ro2TQptmpx4IjyAJp+jAIQ=; b=NInGu6032Knm996Wzl7iaYo4iM6kyNsvGAP94l4ghFZkSLvNae0PUSTCq2w52ZU1Zw rjjJ+mJ7HmKU6f2epG/VOqdmuVJS0JWds+2AFj8eu3FC3Sv4uwF/nyV9JZ+VdlAzq7Yb ZK3o2BhpxG2oAqfDVj3pOZDNeF/4h0PwSaXNBhiJzgaNRIEYTD2/AwFI1Df3ng1dcVwz Yla0dB0pN3jEAwJwqty+RGMGziShUEVmOjG1C4KbdMT8I9qj+fdJ7ehny3L75M5AqUxE sB4yho1qs0PICjKfhjwerircLApZHy2suIjPRxEzOUoDyx9z1BirX+rXEzI1BnRVlYKk 8RhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="RTukz/I1"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h4si11165014edv.124.2021.02.01.13.26.28; Mon, 01 Feb 2021 13:26:52 -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=@google.com header.s=20161025 header.b="RTukz/I1"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232357AbhBAVZd (ORCPT + 99 others); Mon, 1 Feb 2021 16:25:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbhBAVZb (ORCPT ); Mon, 1 Feb 2021 16:25:31 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1EC3C06174A for ; Mon, 1 Feb 2021 13:24:51 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id e9so10773351plh.3 for ; Mon, 01 Feb 2021 13:24:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=Stmza4ZljYVmGoBag2te1ro2TQptmpx4IjyAJp+jAIQ=; b=RTukz/I15+gomvoxURNPYBaO+iQPAJQ7j8SPTDDhq9UlRjA6hVVdohEFSjz2NLtxzu te4v/zkr2CANQypbMIiFFGvE+IgZAs8yeXiVvxbwVfWfqEyz9Kf5KYxTCiM11sw79LRr lERUPtgup7HUjlKpkk9qpnbY1hnUvEx6r1sbv0Qh1zEvsAeHMVdgD5IhyQ5QT5PO4aIG Ez1F850YBZsn3AqraRfPHUDSCungyeAeR3/3rRZAXBsP7wjLZipfQm89OmyCF9GAcO1t 0eL5xJ7Cm8fAKBZWXSTWb3Fwe8M73WqUY17YBU+udWeGB0YtyDZ33tdpC9sbCxtdQH0s o+yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=Stmza4ZljYVmGoBag2te1ro2TQptmpx4IjyAJp+jAIQ=; b=GWSJd1OEKQLs24iWlprxYOlN0meG4jJWr10VBNeprce90yntV56jUbjQfTBNBgnwkC MoC5WA9kQa9m62dBRmYdO3djGS4Z0FAejCOngtFFO+j61WSog8nAdgKhzMQT9day/Ria XwiANHFa1xBQ1e6zKvTJGnUNSi/tW/3BUmdu//h+fPmNOREdzhd1aeOCBvkF4pvjweRC lJdYyQ8tCDq99l363gap+8nynqJFBx8CWvvYg1iqrvTbFqWTxnDLeSDxjnZuzXzpY38J n5NEDyfZ6qqblywPzu9JmfJ0tpXoW76pjNhNW6rGvaByqxmTmOq7blbr2DBgfxnsYWOX ljHA== X-Gm-Message-State: AOAM530tRmPRSI3GRwn00XJuO386tdd27JfJYVW24OCwo3x/oE7S6jmn 1Yfe/spao4Py1FoKWdsLwa7Lkg== X-Received: by 2002:a17:902:b213:b029:db:3a3e:d8ad with SMTP id t19-20020a170902b213b02900db3a3ed8admr19643118plr.73.1612214690922; Mon, 01 Feb 2021 13:24:50 -0800 (PST) Received: from [2620:15c:17:3:4a0f:cfff:fe51:6667] ([2620:15c:17:3:4a0f:cfff:fe51:6667]) by smtp.gmail.com with ESMTPSA id y11sm18311381pfn.85.2021.02.01.13.24.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 13:24:49 -0800 (PST) Date: Mon, 1 Feb 2021 13:24:49 -0800 (PST) From: David Rientjes To: Charan Teja Reddy cc: akpm@linux-foundation.org, vbabka@suse.cz, mhocko@suse.com, vinmenon@codeaurora.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: page_alloc: update the COMPACT[STALL|FAIL] events properly In-Reply-To: <1612187338-19100-1-git-send-email-charante@codeaurora.org> Message-ID: References: <1612187338-19100-1-git-send-email-charante@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 1 Feb 2021, Charan Teja Reddy wrote: > By defination, COMPACT[STALL|FAIL] events needs to be counted when there s/defination/definition/ > is 'At least in one zone compaction wasn't deferred or skipped from the > direct compaction'. And when compaction is skipped or deferred, > COMPACT_SKIPPED will be returned but it will still go and update these > compaction events which is wrong in the sense that COMPACT[STALL|FAIL] > is counted without even trying the compaction. > > Correct this by skipping the counting of these events when > COMPACT_SKIPPED is returned for compaction. This indirectly also avoid > the unnecessary try into the get_page_from_freelist() when compaction is > not even tried. > > Signed-off-by: Charan Teja Reddy > --- > mm/page_alloc.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 519a60d..531f244 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -4152,6 +4152,8 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, > memalloc_noreclaim_restore(noreclaim_flag); > psi_memstall_leave(&pflags); > > + if (*compact_result == COMPACT_SKIPPED) > + return NULL; > /* > * At least in one zone compaction wasn't deferred or skipped, so let's > * count a compaction stall This makes sense, I wonder if it would also be useful to check that page == NULL, either in try_to_compact_pages() or here for COMPACT_SKIPPED?