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=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 93C30CA9EBC for ; Fri, 25 Oct 2019 13:44:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 57EF421D71 for ; Fri, 25 Oct 2019 13:44:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="Qq1IRmOU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57EF421D71 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F2F606B0003; Fri, 25 Oct 2019 09:44:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EDFFA6B0006; Fri, 25 Oct 2019 09:44:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DCE4D6B0007; Fri, 25 Oct 2019 09:44:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0039.hostedemail.com [216.40.44.39]) by kanga.kvack.org (Postfix) with ESMTP id BC78D6B0003 for ; Fri, 25 Oct 2019 09:44:48 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 69CDD4DAC for ; Fri, 25 Oct 2019 13:44:48 +0000 (UTC) X-FDA: 76082427456.22.power75_cc4050b4de1a X-HE-Tag: power75_cc4050b4de1a X-Filterd-Recvd-Size: 4404 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Fri, 25 Oct 2019 13:44:47 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id l24so1569713pgh.10 for ; Fri, 25 Oct 2019 06:44:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=GB66w5zMnO6g29s6wAcFRJIvcQvj59wk11SwJfYrvKA=; b=Qq1IRmOU8QQXXK5dP7qVkmSaMc2yq7Rpi0+jYuWk5ryK9uF4E/5Q5RAo6IRi5rQpYO MijLDpKbtbCl53iC6+V6cSZa6ckR+CG9NvnGZp30+L7k1AHj4QImzgeXM8RnK6zDGsxq bVKbAvbgwnymLXAiH9nIW3DslByuA/r3z+vVz91vWhYVOQeXG4OoYJsj+3h4TlAZKdJD jZjGj8QlSuEFEGqmfb6p9Jd2kqOSjwRtjpebArzGY1EAP86Y2gQqvnJ3LHir/ZHbMuIJ ZLFAs2oRcdHHpbtABfKICAgOeJspOrdnp/ZB5wjPI65JZEcHb1rljP+Du8ppywyo5RBY OAWQ== 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:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=GB66w5zMnO6g29s6wAcFRJIvcQvj59wk11SwJfYrvKA=; b=uXqJ6sK+3qgdqItbSZNs5BJ8BvSYcOjNN5FK6hOek8yeVISYyE/skPyXXuvVMqdx3r j020KgRQ2hxcPOazj1kDasLek+r1h17QFQdiQ8utKGLvkItWl5oR/KClL/13jV7S3vkM HJM0sYAwWoXnnvcoBxWJ/M4eYTx0L7Ar0rHpvo5AShw2UGPPfN9LsKzl4qmTngmo+wp2 YOhP2it9cGt7FO2kUHhQlspBu24hM6F2lk8BhVfpcg2nEinkxEeZeRsmKTGx/HVVjKTa ETTu6P5EU68ZPdobD/F9A1SGy88QnA7ULDw03QfpZWuuREXsFg9fIWUsERBcfeUNecIO IFRw== X-Gm-Message-State: APjAAAXNt+AzjbKnwNALeYx2JhM1i83SRZXoRA3Nd7xQc8ydJWTRO6nj hHmsSLz/Fx8YmhbaPVAWC23iJA== X-Google-Smtp-Source: APXvYqyiEFjS0AsnLhLndE+VCdtmMKp2KjunxS32g/fNq7UVoFTUkMLRgGPV3k3rKDum27SdorNUaw== X-Received: by 2002:a17:90a:9f94:: with SMTP id o20mr4347710pjp.76.1572011086048; Fri, 25 Oct 2019 06:44:46 -0700 (PDT) Received: from localhost ([2620:10d:c090:180::553e]) by smtp.gmail.com with ESMTPSA id y17sm2913564pfo.171.2019.10.25.06.44.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2019 06:44:45 -0700 (PDT) Date: Fri, 25 Oct 2019 09:44:43 -0400 From: Johannes Weiner To: Michal Hocko Cc: Andrew Morton , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 5/8] mm: vmscan: replace shrink_node() loop with a retry jump Message-ID: <20191025134443.GA385668@cmpxchg.org> References: <20191022144803.302233-1-hannes@cmpxchg.org> <20191022144803.302233-6-hannes@cmpxchg.org> <20191023141857.GF17610@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191023141857.GF17610@dhcp22.suse.cz> User-Agent: Mutt/1.12.2 (2019-09-21) 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 Wed, Oct 23, 2019 at 04:18:57PM +0200, Michal Hocko wrote: > On Tue 22-10-19 10:48:00, Johannes Weiner wrote: > > Most of the function body is inside a loop, which imposes an > > additional indentation and scoping level that makes the code a bit > > hard to follow and modify. > > I do agree! > > > The looping only happens in case of reclaim-compaction, which isn't > > the common case. So rather than adding yet another function level to > > the reclaim path and have every reclaim invocation go through a level > > that only exists for one specific cornercase, use a retry goto. > > I would just keep the core logic in its own function and do the loop > around it rather than a goto retry. This is certainly a matter of taste > but I like a loop with an explicit condition much more than a if with > goto. Yeah, as the changelog says, I'm intentionally putting the looping construct into the "cold path" of the code flow: we only loops in a very specific cornercase, and having the whole body in a loop, or creating another function nesting level for it suggests otherwise. A goto seems like the perfect tool to have a retry for one particular caller without muddying the code flow for the common call stack. Matter of taste, I guess.