Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4545433pxv; Tue, 29 Jun 2021 09:26:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPXayI6LgfMKuFvUUEZSjeXodXRXsBDoLtabHhN4OUQv0A0g+B1ZnCXwcdlutVtixNuN69 X-Received: by 2002:a02:76d2:: with SMTP id z201mr5110999jab.21.1624984019271; Tue, 29 Jun 2021 09:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624984019; cv=none; d=google.com; s=arc-20160816; b=WeKT03wF+03C7UVpW8vt2RFWuI0Cy74xGVGEv8WiI7WxETp+SqoWRBtEFhyH2gTx8v R9hk0Bsl3EEDsAQVBNQyvFCGiMvc9bvTyLTfXBHBZI7V3ubSoqPYvSgtMtwyXeWJrUdl aZYgJaUSAcu/J7e6SJ6A9bgH6wd9a4l2Mbcvf537AgDq2PyGZ2tJuJBSllmrnSnYuald IQ3Mh2dLsfhGwnKUMrWL0ls2qBz2oOpVIZmXWYfuP+8Y5F0A7aADeSHGF8U2y+/sKN5v rbSttJ+FNO7oXOXO63sM5Ct6FKLLQFO1Jppfgo7PvR2QXhSlvxd2UgZXHwKmF7uGRTHq cRtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=epo3zKiTfhS1s7uCWxNYZiOm+vo3zbXKhTVM1Kqzmbg=; b=F6ibl7xcytmq8qIyT8sKMDgO4OERQwMShgGpmuzh77/GrkxWzPA5Q5IaZ7WjPcv9yF 8ms5W62O1t6vltjrlq+joN+32qYlFZCaHm87NGRRcJVo5+GJF48t4D5tI/2gfZKKL82K Fm547yzthM6aKd8e98X+7q63V1RqwjPgI+U1zJ8btq5JBb666MNhxg0rjA+1pAnoB3Gp 76AkW52jJBeXFGZCxoEH7GjommCTx5ywtDi+lbh1q3eqf0wfo4U6ugGc94VRhOUgGrbW v/48og0eJGjVQ/jpnxmxOglW1Ob5Cwr1Fh8ezgEipoLMo1TVrHWDy3/5EETEcscrLcIU Jehw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BvAsn6V+; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m7si25823614ilh.114.2021.06.29.09.26.47; Tue, 29 Jun 2021 09:26:59 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=BvAsn6V+; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232018AbhF2OGL (ORCPT + 99 others); Tue, 29 Jun 2021 10:06:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231512AbhF2OGD (ORCPT ); Tue, 29 Jun 2021 10:06:03 -0400 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1A30C061760; Tue, 29 Jun 2021 07:03:36 -0700 (PDT) Received: by mail-qk1-x730.google.com with SMTP id y29so29567524qky.12; Tue, 29 Jun 2021 07:03:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=epo3zKiTfhS1s7uCWxNYZiOm+vo3zbXKhTVM1Kqzmbg=; b=BvAsn6V+lEebL9543XNZN8ZgjQb+osEKHPTuXHALEL19Dqb6/zJ1xRDLLweEL6wFZe nCCZ9qgxxMvqfBg0PIRP27jmbc8ViBnRr2O1g5R9fD2B8DKZbSkVH6hdzgMoPIUWzHeV u9B76ZOBRd9zRYeaOAP24ARezCGz/5LgXUOcEzlvE1OffxKOhgMBdA+uNkK66LNl3be2 4qSEXMtzyF67GlNoC0wg7jZ+nuozmqOqplCuU3fIEYFxurWmsax7mrIOp7Vt3dLHEqxZ NEM5Qmqlf4GdsA+ghm9u58I4sopLY1RF+S0SNXXwMWYDVwaevKsyyuATbPEouicRln0n JZow== 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; bh=epo3zKiTfhS1s7uCWxNYZiOm+vo3zbXKhTVM1Kqzmbg=; b=k8ghkFCGTFs7p+XjM5WuTay9icRHM6gOMBgdeWskAA1aIISS+ZRrn6EeSKN6vHoalH 1KVzeyVFSYzhXLvuyTOvnihKg2vOb6BNWXlSxEe0h7EBr9w/ehL6a+SY25AEUgFeapKn lbbQZgLdoXiwMc5eTEXGGc2Omv0gfDRHQVg4murpNL7tEGR4NId8suJajuEUHn2chMfB yh2Jy3euOSLvIbM4LJLJeRikwwWQxHR5aHbW4d/stzW3IiG1b31ykWcgBkawrsD2SWia fXmcULAJNQMMvYTxWRL5O4J79dQ/oh0S8PEx50f3MYzWdbc5TUr7c9RuRYrccLf2Z0AS VeYw== X-Gm-Message-State: AOAM5310FsEF8Qs2UnH4DVM1SZxNYfFaFRQjgaOxDB8CQ4BcxrwFRhmq bU4ks4MyM5/6lJvYr8uY4MubYd5wYw7B1g== X-Received: by 2002:a37:9b4b:: with SMTP id d72mr16414129qke.10.1624975415813; Tue, 29 Jun 2021 07:03:35 -0700 (PDT) Received: from dschatzberg-fedora-PC0Y6AEN ([2620:10d:c091:480::1:85ab]) by smtp.gmail.com with ESMTPSA id n128sm845772qkd.93.2021.06.29.07.03.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 07:03:35 -0700 (PDT) Date: Tue, 29 Jun 2021 10:03:33 -0400 From: Dan Schatzberg To: Michal =?iso-8859-1?Q?Koutn=FD?= Cc: Andrew Morton , "open list:BLOCK LAYER" , open list , "open list:CONTROL GROUP (CGROUP)" , "open list:MEMORY MANAGEMENT" , Johannes Weiner , Jens Axboe Subject: Re: [PATCH 3/3] loop: Charge i/o to mem and blk cg Message-ID: References: <20210610173944.1203706-1-schatzberg.dan@gmail.com> <20210610173944.1203706-4-schatzberg.dan@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Non-inlining in the loop module doesn't seem like a big trouble. OTOH, > other callers may be more sensitive and would need to rely on inlining. Yes, this is my concern as well. > I can't currently think of a nice way to have both the exported and the > exlicitly inlined variant at once. It seems it's either API or perf > craft in the end but both are uncertain, so I guess the current approach > is fine in the end. > > > Yes it is intentional. All requests (not just aio) go through the loop > > worker which grabs the blkcg reference in loop_queue_work() on > > construction. So I believe grabbing a reference per request is > > unnecessary. > > Isn't there a window without the reference between loop_queue_rq and > loop_queue_work? Hmm, perhaps I'm not understanding how the reference counting works, but my understanding is that we enter loop_queue_rq with presumably some code earlier holding a reference to the blkcg, we only need to acquire a reference sometime before returning from loop_queue_rq. The "window" between loop_queue_rq and loop_queue_work is all straight-line code so there's no possibility for the earlier code to get control back and drop the reference. > I don't know, you seem to know better, so I'd suggest > dropping a comment line into the code explaining this. I wouldn't be so sure that I know any better here :D - I'm fairly inexperienced in this domain. Where would you suggest putting such a comment? The change in question removed a particular case where we explicitly grab a reference to the blkcg because now we do it uniformly in one place. Would you like a comment explaining why we acquire a reference for all loop workers or one explaining specifically why we don't need to acquire one for aio?