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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9243C7EE2C for ; Mon, 29 May 2023 16:38:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D3D46B0072; Mon, 29 May 2023 12:38:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 38495900003; Mon, 29 May 2023 12:38:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24CF5900002; Mon, 29 May 2023 12:38:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 184796B0072 for ; Mon, 29 May 2023 12:38:10 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id DD3231A02BD for ; Mon, 29 May 2023 16:38:09 +0000 (UTC) X-FDA: 80843849898.14.437B576 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) by imf30.hostedemail.com (Postfix) with ESMTP id EC89A8000C for ; Mon, 29 May 2023 16:38:07 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=VjcnSTm2; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf30.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.178 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685378288; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5+bYmjm/h3lSQb6YeDlPhS20QMHi1e0gJPfH5ZggpcM=; b=eVuvon5ExfosKyk7Y6S7m1YAVvs5UeLx7HpLDcGvvojktmb6L2j1dXJGQm+xx2vpgBhZJf tprD5ppDMUeea2irhkkKD7DIOIiGEXGqUqMTzAt1WpJLtdnSuyKYmkaBxiGVl2T3mt5S7o 1UpyIClBxIzxUazV7bDQd1BCosCOECM= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=VjcnSTm2; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf30.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.178 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685378288; a=rsa-sha256; cv=none; b=670TtXfYm4RSaaS3FixX0dZ20AerfmRYxpx2i9/SR7PUxpi5/x2Qauj73Xuk+IRpRHHKi6 9fNxQzG8Tea7aBTNNpAZPXcd+wj6TBxRJ5vsvt/Q3q7jccs2PNIIOerKY3hKyYODrmuLB1 CGTWG3MgvJZzHe1BASk5NKREPpsr3UQ= Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-75affb4d0f9so187671385a.2 for ; Mon, 29 May 2023 09:38:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20221208.gappssmtp.com; s=20221208; t=1685378287; x=1687970287; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=5+bYmjm/h3lSQb6YeDlPhS20QMHi1e0gJPfH5ZggpcM=; b=VjcnSTm21NLYuq3Hsb35yyozR88wKTebBbs9dHpvp+dCIlp6iyJHyLrsRWU6vvrkbG 4gAZcuffjQMzN6ybk3oKLBN9Z/z5P5KXbhxpkTMi9gzG/fJsJEUH4QCeKw3+ykIJr/l+ X1Eg5LdU/NffGKk4gHN066XjQiqD4YOcxktk+v5ofHaJ2DhiV3/zuawItrLKWvtvVJL2 kQQ0D/R1LkeiRtRfKLwblI/Hj1DjpRVbHsYa/xUVQpGcwyX186+67q2SrcoIwgFVYjUw vMjdmkk99MGrvDd+ZIl3wTn64jx8aypK/3q4Cx+RWIMxyHSk2S8GiCQM71IIuRA7D1p2 GvEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685378287; x=1687970287; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5+bYmjm/h3lSQb6YeDlPhS20QMHi1e0gJPfH5ZggpcM=; b=fKG0yt9i0f4wHQTl1/TVELWaL78VmRwvbXsfHoLbCC1plszptSLvIRSNqo5MVu7Zz4 buTl+gmITwoQKdUoQkb2BCqh7C6miP2YOOEHMLildXLqhpDxm3Y3ppKFbqUqmFnMO0j9 r9XTXsoELGK9Zmqe5E1TrjsAPXwXs3aso7JW9FgivO5iJMoBMqsYGfobNY2BEktE7e2W 2p4nUL5ZIA/azT7gLeX+r807jsh/YEKFBCvGgSh5mx3PJhOMbYDmC/ZhyN42sz8CPMVT KEyLSIWHiuDbKlP3CnsmliJQ/QOEEepx6oXUABB4VsmNuyL3maVA/f+bYOhtyU7bayCq N4pw== X-Gm-Message-State: AC+VfDxYt/HjJ/9BMtjaYAGNZ5SkmyE+mN8R6prt3lHrPqmYUwV9/6AG 5MRLK8KiZwhive+TbyKsq6DwFw== X-Google-Smtp-Source: ACHHUZ7eFEKc4LAfBL2BydTImTW8cO2OyoprqG9Z/iSmHb1f4gXFTT1bFTyReeN1fL6F2fzQ2sGpvA== X-Received: by 2002:a05:620a:1b92:b0:75b:23a0:e7d9 with SMTP id dv18-20020a05620a1b9200b0075b23a0e7d9mr8117975qkb.58.1685378286917; Mon, 29 May 2023 09:38:06 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:8bb6]) by smtp.gmail.com with ESMTPSA id y23-20020a37e317000000b00759495bb52fsm3450186qki.39.2023.05.29.09.38.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 09:38:06 -0700 (PDT) Date: Mon, 29 May 2023 12:38:05 -0400 From: Johannes Weiner To: Vlastimil Babka Cc: Andrew Morton , Mel Gorman , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 2/5] mm: compaction: simplify should_compact_retry() Message-ID: <20230529163805.GA84971@cmpxchg.org> References: <20230519123959.77335-1-hannes@cmpxchg.org> <20230519123959.77335-3-hannes@cmpxchg.org> <1c3c9305-a678-279e-f015-7aed544ab3c8@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1c3c9305-a678-279e-f015-7aed544ab3c8@suse.cz> X-Rspam-User: X-Stat-Signature: 7nxm9qbbipm9wjphizp4w6c7dxxue1mg X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: EC89A8000C X-HE-Tag: 1685378287-284817 X-HE-Meta: U2FsdGVkX18L7PXwsozdj3UfcOicgCTOxlr38OI5TdoHQmHcP7Um/tav4GrxcDMmQ1WbJBPPDyqRomXWyrGvOJA2yZv5pd3jwSwTsFdtwb0CTr6y/zdVubXzhDBOTJA9nQXJ4rcpzc0eWGozj7lGJOH6abiWEJUtlHoZcfiAqCQBt2fLPtomw47CoBEdYV/WS2lIDGLN30VXZlOb2wc+FgcPo8FX9vAOBSLuQJQTa0NNqpjlq5UQVfsXi+X2IVEnOvJrXzZ8adr/MEGOk2EcHVAN2VF772m4oYk370Slr4Yiqao8bXiclHwjgmujw3da1PlfMgs4C2Sd5VEXbIeSJjVvWxi5sLeGBbP0nhxhuG8z4BG3yZUsqwi6ksYMSvAfiUf7PjgtrgU4a6Y4reOMpMJKcynuGKh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KPyQe48JyMOAeQcsXGT7yeLSgZQjml8qdoOCwSRSQRcbSzIQ5rhWw== 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, May 29, 2023 at 03:03:52PM +0200, Vlastimil Babka wrote: > On 5/19/23 14:39, Johannes Weiner wrote: > > The different branches for retry are unnecessarily complicated. There > > are really only three outcomes: progress (retry n times), skipped > > (retry if reclaim can help), failed (retry with higher priority). > > > > Rearrange the branches and the retry counter to make it simpler. > > > > v2: > > - fix trace point build (Mel) > > - fix max_retries logic for costly allocs (Huang) > > > > Signed-off-by: Johannes Weiner > > --- > > mm/page_alloc.c | 53 +++++++++++++++---------------------------------- > > 1 file changed, 16 insertions(+), 37 deletions(-) > > > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > > index 5a84a0bebc37..72660e924b95 100644 > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -3772,16 +3772,22 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags, > > * Compaction managed to coalesce some page blocks, but the > > * allocation failed presumably due to a race. Retry some. > > */ > > - if (compact_result == COMPACT_SUCCESS) > > - (*compaction_retries)++; > > + if (compact_result == COMPACT_SUCCESS) { > > + /* > > + * !costly requests are much more important than > > + * __GFP_RETRY_MAYFAIL costly ones because they are de > > + * facto nofail and invoke OOM killer to move on while > > + * costly can fail and users are ready to cope with > > + * that. 1/4 retries is rather arbitrary but we would > > + * need much more detailed feedback from compaction to > > + * make a better decision. > > + */ > > + if (order > PAGE_ALLOC_COSTLY_ORDER) > > + max_retries /= 4; > > > > - /* > > - * All zones were scanned completely and still no result. It > > - * doesn't really make much sense to retry except when the > > - * failure could be caused by insufficient priority > > - */ > > - if (compact_result == COMPACT_COMPLETE) > > - goto check_priority; > > + ret = ++(*compaction_retries) <= max_retries; > > + goto out; > > I think you simplified this part too much, so now once it runs out of > retries, it will return false, while previously it would increase the priority. Oops, I'll send a delta fix to Andrew tomorrow. Thanks!