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=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 A36B6C433E6 for ; Fri, 5 Feb 2021 22:28:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2FA6B64FEE for ; Fri, 5 Feb 2021 22:28:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FA6B64FEE Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 640BE6B0006; Fri, 5 Feb 2021 17:28:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F03E6B006C; Fri, 5 Feb 2021 17:28:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DE6D6B006E; Fri, 5 Feb 2021 17:28:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id 36E3B6B0006 for ; Fri, 5 Feb 2021 17:28:12 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id ED6898249980 for ; Fri, 5 Feb 2021 22:28:11 +0000 (UTC) X-FDA: 77785653582.05.robin33_6208c3d275e8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id D4B201801D01B for ; Fri, 5 Feb 2021 22:28:11 +0000 (UTC) X-HE-Tag: robin33_6208c3d275e8 X-Filterd-Recvd-Size: 4938 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Fri, 5 Feb 2021 22:28:11 +0000 (UTC) Received: by mail-pj1-f51.google.com with SMTP id d2so4614163pjs.4 for ; Fri, 05 Feb 2021 14:28:11 -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=0CThZisk8ypQGjJO6x1LhHL7Xhm/PdgdSDv39h3UwsE=; b=kfZf/3+weJ8zVno0BYKgnjRpYC81thjaKMZAsYaxC+Xv4UfuDcUIKDg0soTXizlRQh ujNDcloW52Kjq3Kt0DK08lZIlPneGikcstO31NRpkGQTzV3HQ93UIAMFy4eLJkW/XOsN rPcr2gIDi/kRqCmMbER9s+G8hqfoj2TLnrepBRsGksMH2yYpj/TQH1r2yWBZTnwjH2Yh FU7nj8sCNYHjlNqYU4NBTdQXtCFN8wVNQ9suoS7Y6FoDd5iyVcGev1uWLaZiM/dqMaYG qTmBr7QvxSwrzyTpli/TD7f2KVO91TJiREN3vatXv+q5NdGdb+vGqxiroZz6PWG0wyIX IvdA== 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=0CThZisk8ypQGjJO6x1LhHL7Xhm/PdgdSDv39h3UwsE=; b=AenHkcT40a4MN37JeWWrfp27vwR709eXvAEc4W4GmGYs8Rnf4MvxPeHBcLsBiYI4hm ZTN07TQvrpSTsbJOL0hSPyuVHKyJbe5hggbIXWm7ATmSgQgqmjc+S5TEXbklNcBJ12bp 96e7CC8vBMuX4u7xYOwVHhrsY9PGEI7saov+plcPo/EgN7kIyLKY4/N84KljY4F3GNRj 0jSKzJVaqdxJy7piAgUxT+gBoolPnIt4dqRt7ZfcGzg6Aynwed63U5NnORHVT2wF2qT0 pduHNS+0hIinjqJORJls0pCa9kZHsOArvEsJWpfOqJsDNuLHSIR8alc1xQeXkp/h4VfP 28vw== X-Gm-Message-State: AOAM533tYfsdc9s+KPdmeGMmzo5yLMvVyRRI5II9grnRikEFjCrTgcJH q/t7haXV1DhZeKGxe6pDbXDD7w== X-Google-Smtp-Source: ABdhPJxSVQe+yUAaLkMTiBzc/R0XsRwjAVkpN3+DgaCr016qPC6alZV15o2OMeyY6o6pm7xih6C+Jw== X-Received: by 2002:a17:902:b411:b029:e0:8f0:5ba with SMTP id x17-20020a170902b411b02900e008f005bamr6124016plr.19.1612564089949; Fri, 05 Feb 2021 14:28:09 -0800 (PST) Received: from [2620:15c:17:3:71b0:f7a6:59ec:6ab3] ([2620:15c:17:3:71b0:f7a6:59ec:6ab3]) by smtp.gmail.com with ESMTPSA id s21sm11115691pga.12.2021.02.05.14.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 14:28:09 -0800 (PST) Date: Fri, 5 Feb 2021 14:28:08 -0800 (PST) From: David Rientjes To: Charan Teja Kalla 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: <160ba3b5-2cd4-5ff0-1348-fb477cefd33d@codeaurora.org> Message-ID: <1213f4c6-7557-268d-253e-23f8fea55b19@google.com> References: <1612187338-19100-1-git-send-email-charante@codeaurora.org> <160ba3b5-2cd4-5ff0-1348-fb477cefd33d@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 Tue, 2 Feb 2021, Charan Teja Kalla wrote: > >> 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? > > In the code, when COMPACT_SKIPPED is being returned, the page will > always be NULL. So, I'm not sure how much useful it is for the page == > NULL check here. Or I failed to understand your point here? > Your code is short-circuiting the rest of __alloc_pages_direct_compact() where the return value is dictated by whether page is NULL or non-NULL. We can't leak a captured page if we are testing for it being NULL or non-NULL, which is what the rest of __alloc_pages_direct_compact() does *before* your change. So the idea was to add a check the page is actually NULL here since you are now relying on the return value of compact_zone_order() to be COMPACT_SKIPPED to infer page == NULL. I agree that's currently true in the code, I was trying to catch any errors where current->capture_control.page was non-NULL but try_to_compact_pages() returns COMPACT_SKIPPED. There's some complexity here. So my idea was the expand this out to: if (*compact_result == COMPACT_SKIPPED) { VM_BUG_ON(page); return NULL; }