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 EEFA6C64EC7 for ; Wed, 1 Mar 2023 05:09:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 48CF36B0073; Wed, 1 Mar 2023 00:09:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 43CC06B0074; Wed, 1 Mar 2023 00:09:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 305096B0075; Wed, 1 Mar 2023 00:09:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 1E56C6B0073 for ; Wed, 1 Mar 2023 00:09:42 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E02F114113F for ; Wed, 1 Mar 2023 05:09:41 +0000 (UTC) X-FDA: 80519151762.03.835E82E Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by imf22.hostedemail.com (Postfix) with ESMTP id CBED7C0002 for ; Wed, 1 Mar 2023 05:09:38 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf22.hostedemail.com: domain of hsiangkao@linux.alibaba.com designates 115.124.30.130 as permitted sender) smtp.mailfrom=hsiangkao@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677647380; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NPh1/pbrsrRn0CgZhsHjiHQKq0a0h5wGEq9FmNdDZG4=; b=xJRbDNEAHmjEO1EugDB5jK8u1Qsre2nhSG6sspBvlDOFiHwpH5enn0BIgQxjUi9N7n4T/5 ++f8X1SlxUcdlCgMYyScm8GgbVBs3oaTJJSCLBdKqKqp61yNTh7VGdVP3OusOV5mdHcFzR 3MBObkXZW1SS4ipF1i4jVEXUTAB8hyo= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf22.hostedemail.com: domain of hsiangkao@linux.alibaba.com designates 115.124.30.130 as permitted sender) smtp.mailfrom=hsiangkao@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677647380; a=rsa-sha256; cv=none; b=DQNsYZi6+KTsbvwgRP1e8GUnJzXxq8uJM0mk3HV/FOMqYqllT6TiFNpU8PFwDAcPhVdxt4 F6s3kMaRFAHZweFzD6Q8YFyqwqx4fYwfpV2VQ9VQKFPz3dxm02l0xu/ZzhYt0M47ZV6uHr 3YeXhpIcMOqt0XDyINzoxUmuVqtZ/Ko= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VcoGY3z_1677647374; Received: from 30.97.48.239(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VcoGY3z_1677647374) by smtp.aliyun-inc.com; Wed, 01 Mar 2023 13:09:35 +0800 Message-ID: <49b6d3de-e5c7-73fc-fa43-5c068426619b@linux.alibaba.com> Date: Wed, 1 Mar 2023 13:09:34 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [LSF/MM/BPF TOPIC] Cloud storage optimizations To: Matthew Wilcox Cc: Theodore Ts'o , lsf-pc@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-block@vger.kernel.org References: From: Gao Xiang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: CBED7C0002 X-Stat-Signature: cgm79ksq8ob8h7aj5mxehse913ud8qxt X-HE-Tag: 1677647378-107753 X-HE-Meta: U2FsdGVkX1/yT6UO7+BEAf2EuvhXI/2dgPsIdUxfKZWODERmvvLtupSyLxy9x2+y63NLQUl20JsNhLT546oH//oXRUuI/0N6kZ2SzTLQbTJJlq/zOTfLkeea0qh562EaDuMZFqJGFlclbaP1BK5UoXf9g0eFR/pd77blKno2vNvl2gfTBQIvYXk+WMu6L7+fRQvBaowNeDqgunm5r3oOn8qh/4Rdx1x4adxdz4IxbydWD3dRFfSRZFy94njsq0NRxiMrqlNb7F36oV4jX88vFFX9t74gEqsTKwt7irR//DyTqe1qtEkUueC4g2dxAxYOJig5a+qzXVIua6lg8J+u6NKexVxndNGSoWyu6i4KrgsQ0n7gYF6+7DFrcC/34te/hyH3fQBbYL0G1eTEJpW6YIxFm2bhOerL4yS5I5HUNvhdkRo6f4IAKQiQhqg3vUdJGu+LKaM8JWEDIaFKaeGZzOgHlTJW3E9W+gDunUvC5MlkVLSpknfRLx1dhX4wtbrLQd7KL3D1v6f3afV3kzcM5gTT7nTRaoqtQmPiD1JaIt05R7YAL5419Pb2dXN6TLHUmtg8xJwm/V5yG6gpHSzZWfptTJ2Fp0eTOjeffjPKtpt8ELk96OG21kRBQZrq3pIhSoceSMMRJneTJ8XV/iym+nIS8XFFjV88esbWF0xoNzZ//5opCeJ79wM2MkSwE6w4sfmccX6Byx+VuFkcjBRkWOlAOQQ6Zl5oxaDMyZc37nOGBxwJk79zmbfAqSpjZ3Ftvkfs+PQlrMTpHGffRz71hIrYj/iT1VQMiwLvZsREtCtQZgW3AXSH9bR0+KWkKpKMSpMvhRIFH3TrUB4f7adkZV7eiKRk8woQEvgUIfdwOnxjLXnL2NQup+nPYCD3OFNDLN+4EQOGA7RFBEMQYrcpE4LCB+HokOoY1A3Nh9MlnPedT1XTTYjYcI8d30W7iYWtReqHwIeI1LDIJMmaJPn ZONjMt8q E8x0lrkI8l4QN/doGouoqtCjtj/W8QqbSIe0Z3KprxHrMYCymAcka9p8/6UOFhrk0KFSsR2k/BZOQyGdRpyotfXiT0Tsk0LgL04VvG39vR+UaQQlc7HolQeAyAhuxPUqpFjo5cwhGnwyoZiE/KX7ybS1WqAm7YVyjoXsG5K9uIoxGVw1ovatAaJBEt+9Jd92Ldtfv 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 2023/3/1 13:01, Matthew Wilcox wrote: > On Wed, Mar 01, 2023 at 12:49:10PM +0800, Gao Xiang wrote: >>> The only problem is that the readahead code doesn't tell the filesystem >>> whether the request is sync or async. This should be a simple matter >>> of adding a new 'bool async' to the readahead_control and then setting >>> REQ_RAHEAD based on that, rather than on whether the request came in >>> through readahead() or read_folio() (eg see mpage_readahead()). >> >> Great! In addition to that, just (somewhat) off topic, if we have a >> "bool async" now, I think it will immediately have some users (such as >> EROFS), since we'd like to do post-processing (such as decompression) >> immediately in the same context with sync readahead (due to missing >> pages) and leave it to another kworker for async readahead (I think >> it's almost same for decryption and verification). >> >> So "bool async" is quite useful on my side if it could be possible >> passed to fs side. I'd like to raise my hands to have it. > > That's a really interesting use-case; thanks for bringing it up. > > Ideally, we'd have the waiting task do the > decompression/decryption/verification for proper accounting of CPU. > Unfortunately, if the folio isn't uptodate, the task doesn't even hold > a reference to the folio while it waits, so there's no way to wake the > task and let it know that it has work to do. At least not at the moment > ... let me think about that a bit (and if you see a way to do it, feel > free to propose it) Honestly, I'd like to take the folio lock until all post-processing is done and make it uptodate and unlock so that only we need is to pass locked-folios requests to kworkers for async way or sync handling in the original context. If we unlocked these folios in advance without uptodate, which means we have to lock it again (which could have more lock contention) and need to have a way to trace I/Oed but not post-processed stuff in addition to no I/Oed stuff. Thanks, Gao Xiang