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 AB948ECAAA1 for ; Mon, 12 Sep 2022 08:35:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C1A68D0002; Mon, 12 Sep 2022 04:35:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 271B58D0001; Mon, 12 Sep 2022 04:35:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13B458D0002; Mon, 12 Sep 2022 04:35:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 06C178D0001 for ; Mon, 12 Sep 2022 04:35:09 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C8A7C1C6303 for ; Mon, 12 Sep 2022 08:35:08 +0000 (UTC) X-FDA: 79902773496.31.3489743 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf16.hostedemail.com (Postfix) with ESMTP id 65912180096 for ; Mon, 12 Sep 2022 08:35:08 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 4FDB468B05; Mon, 12 Sep 2022 10:35:05 +0200 (CEST) Date: Mon, 12 Sep 2022 10:35:04 +0200 From: Christoph Hellwig To: Jens Axboe Cc: Christoph Hellwig , Matthew Wilcox , Johannes Weiner , Suren Baghdasaryan , Andrew Morton , Chris Mason , Josef Bacik , David Sterba , Gao Xiang , Chao Yu , linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-mm@kvack.org Subject: Re: [PATCH 1/5] mm: add PSI accounting around ->read_folio and ->readahead calls Message-ID: <20220912083504.GB11318@lst.de> References: <20220910065058.3303831-1-hch@lst.de> <20220910065058.3303831-2-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662971708; a=rsa-sha256; cv=none; b=XTE8U9sZcN5uQtSR3vnkI1Rnn8iU/qCEkVWYs5ydK1VLqg5GgEwr4ZwOOxJ5oP3ozz2hOf M1IM+bB0eKOINWFy0V9n6X0OJYb0cNubXD/pZsWefoc2jjdI5fF17TYZfm6iJs1aja8uBV qsxWdZZQVRMX6F++L0T1zAFj3rhBFeU= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; spf=none (imf16.hostedemail.com: domain of hch@lst.de has no SPF policy when checking 213.95.11.211) smtp.mailfrom=hch@lst.de; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662971708; 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; bh=5vq8C3f5HWNeVw33cDfuotpFQkVcX1H0RN3mzfTTTII=; b=3NAmzrmq2s8MoZf6RDuLfw+8ZXobcXhLRXiqfE532q3aBgwENjcMTNsb7x8+wuL1Jo0MMi 0MlbduhNnPdQYZI7XkmcX0f8P8V0plfg+GxCk2zS+zvX70w7ow3/uH+Sy+gkwmDPZh5Lm2 grFajmGCduGjfY9/ws+0YAyLBACtKHA= X-Stat-Signature: ddrj481r7gkx5b7ipqp58diycabxnx35 X-Rspamd-Queue-Id: 65912180096 X-Rspam-User: Authentication-Results: imf16.hostedemail.com; dkim=none; spf=none (imf16.hostedemail.com: domain of hch@lst.de has no SPF policy when checking 213.95.11.211) smtp.mailfrom=hch@lst.de; dmarc=none X-Rspamd-Server: rspam07 X-HE-Tag: 1662971708-296976 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 Sat, Sep 10, 2022 at 05:34:02AM -0600, Jens Axboe wrote: > > /* Start the actual read. The read will unlock the page. */ > > + if (unlikely(workingset)) > > + psi_memstall_enter(&pflags); > > error = filler(file, folio); > > + if (unlikely(workingset)) > > + psi_memstall_leave(&pflags); > > if (error) > > return error; > > I think this would read better as: > > /* Start the actual read. The read will unlock the page. */ > if (unlikely(workingset)) { > psi_memstall_enter(&pflags); > error = filler(file, folio); > psi_memstall_leave(&pflags); > } else { > error = filler(file, folio); > } > if (error) > return error; I had it both ways. For any non-trivial code in the conditionals I tend to go with your version all the time. But for two times a single lines both variants tends to suck, so I can live with either one.