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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 D1BA4C11F67 for ; Tue, 29 Jun 2021 14:03:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 79D8261DCB for ; Tue, 29 Jun 2021 14:03:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 79D8261DCB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A817C6B00AF; Tue, 29 Jun 2021 10:03:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A31CB8D00F0; Tue, 29 Jun 2021 10:03:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A99F6B00B1; Tue, 29 Jun 2021 10:03:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0218.hostedemail.com [216.40.44.218]) by kanga.kvack.org (Postfix) with ESMTP id 5EF1F6B00AF for ; Tue, 29 Jun 2021 10:03:37 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 39266824999B for ; Tue, 29 Jun 2021 14:03:37 +0000 (UTC) X-FDA: 78306929274.15.AF6E9C8 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by imf08.hostedemail.com (Postfix) with ESMTP id 84B553000089 for ; Tue, 29 Jun 2021 14:03:36 +0000 (UTC) Received: by mail-qk1-f179.google.com with SMTP id q16so9638230qke.10 for ; 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=DhaXkZmcBFqMYn0xaXjgtgia5ECgNcep5wR2qyxZsGySHG7At4GtI5TSu40w863JAp 07XmBawGeOD+XOP6bFlZ5BgcUI0wQoQ2Qo9yL6mYNeRih7cv3ClCM6JkHXAkvIqizXJg zJ5/OHsItwTNU+qLDHMUbEsUZsmWUOUBWUzD0hbaF/UdU4o7w483m8WpX9BwBsVA9Joo B2yHNqAITdhGjvMqUQUMixHToJtoZ3xO6m4dUQdMZGig8YlDNT1BUIN1foJDx2QKn8VK eWQME2QUL1CClkROsD5tITivFddWPwsoczfCbcwGvA2jWE9DDrxxhkC+0S3ZO7hKMnAc eDbA== X-Gm-Message-State: AOAM533JpFryKoYqT+w+ry1i7LkfjOl9tdJOXgKoIif/cBsOaMSeoVZ7 JT2QCbicp57nPWyT/duFXMw= X-Google-Smtp-Source: ABdhPJwF1jHHpUGYvGSGqrM20Y/wdjXItsUPDnGvL02uIcUIMmbhuYPgIoI1h5EDhETkH9lFL4LviA== 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: Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=BvAsn6V+; spf=pass (imf08.hostedemail.com: domain of schatzbergdan@gmail.com designates 209.85.222.179 as permitted sender) smtp.mailfrom=schatzbergdan@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: teiif9foba4i69s7rziku9jcty5sgxrn X-Rspamd-Queue-Id: 84B553000089 X-Rspamd-Server: rspam06 X-HE-Tag: 1624975416-694870 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: > 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?