Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4288577rwr; Sun, 23 Apr 2023 02:26:28 -0700 (PDT) X-Google-Smtp-Source: AKy350ZaNES9WXM2/Msdl94AMcWjz/zNNFgPFSLAeI4MUb9yXzZ5WbsP0Xql5fNSqxIlDe2w2eyD X-Received: by 2002:a05:6a20:244d:b0:dc:e387:5661 with SMTP id t13-20020a056a20244d00b000dce3875661mr14681025pzc.6.1682241988267; Sun, 23 Apr 2023 02:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682241988; cv=none; d=google.com; s=arc-20160816; b=sPYt9nmWhnKcQ7GnDpYOO78dGTXVcuWR0Tz4CBabAnZ9uRR2usjE0DQL3RVlROeZ1Q SD5i/I8ZZrdB1hwgiXWd11+V4TKvd4Ydk75tDEK1iBcOpJA7aqKN7lp2dLk/uBumIGRE nGgvb2crdULgbduHI0BD7keCT1vdljY7znuzzlTVURTe/YoGy2OuOjNfzf3wiz3ZgQBV djDZawYqe+Mlef6VgtxCcpBme/u8JKuP0IwNS22vhf7q4e1hgRk7FfUh6HFoNyiq3WV7 S3IiHsxll8TWuffzkenhtWdQqwEYExe6z4IM18gslMBHraHXk5eYd5CysxaJcs9pHe82 A1eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=Phc0z04hcO4pxngLmfIBzqbchtAJyj33k5kahTTLP2o=; b=Kj+hhBbYcmAOF+gs2biQVgd5XnJv6k03sy2nZSRSPl/V9iu8AKv6iHcmae8ji9xp2c joFlwuPOvKjJ68y8kvS0S2E8d+ZrH0t3AFfdGmCpbWJryLnFR9D9VxRQFnz5DnidlCE8 rTJy55WpyWrV6BJYsOfKILWNRMJPYrm2NJZm9T9A8eBfLP8M9VZ0Fc0juY9SDPIGs8Bu wc0YOCaNP+Tj3hZJ6bTdS3FN/QcbJNR5YOnVxAz5u6tshY0CW9ftvyJdGZTAx6sb7Mvf dQMy00PCepu245GdzbG4SMaEwfJl/AN8jN3YY8XhxMUhUq8xQmFEsYm0cjQpWgwm8+cg mSLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n16-20020a63ee50000000b0051805159a1csi8423569pgk.476.2023.04.23.02.26.17; Sun, 23 Apr 2023 02:26:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229693AbjDWIgC (ORCPT + 99 others); Sun, 23 Apr 2023 04:36:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229652AbjDWIfg (ORCPT ); Sun, 23 Apr 2023 04:35:36 -0400 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1037B1BD1; Sun, 23 Apr 2023 01:35:33 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R521e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0VgjFNh3_1682238926; Received: from 30.97.49.3(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VgjFNh3_1682238926) by smtp.aliyun-inc.com; Sun, 23 Apr 2023 16:35:29 +0800 Message-ID: Date: Sun, 23 Apr 2023 16:35:26 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v2 1/4] mm/filemap: Add folio_lock_timeout() To: Hillf Danton Cc: Andrew Morton , Douglas Anderson , Mel Gorman , Alexander Viro , Christian Brauner , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yu Zhao , Matthew Wilcox , linux-fsdevel@vger.kernel.org, ying.huang@intel.com References: <20230421221249.1616168-1-dianders@chromium.org> <20230422051858.1696-1-hdanton@sina.com> <20230423081203.1812-1-hdanton@sina.com> From: Gao Xiang In-Reply-To: <20230423081203.1812-1-hdanton@sina.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hillf, On 2023/4/23 16:12, Hillf Danton wrote: > On 23 Apr 2023 14:08:49 +0800 Gao Xiang >> On 2023/4/22 13:18, Hillf Danton wrote: >>> On 21 Apr 2023 15:12:45 -0700 Douglas Anderson >>>> Add a variant of folio_lock() that can timeout. This is useful to >>>> avoid unbounded waits for the page lock in kcompactd. >>> >>> Given no mutex_lock_timeout() (perhaps because timeout makes no sense for >>> spinlock), I suspect your fix lies in the right layer. If waiting for >>> page under IO causes trouble for you, another simpler option is make >>> IO faster (perhaps all you can do) for instance. If kcompactd is waken >>> up by kswapd, waiting for slow IO is the right thing to do. >> >> A bit out of topic. That is almost our original inital use scenarios for > > Thanks for taking a look. > >> EROFS [1] although we didn't actually test Chrome OS, there lies four >> points: >> >> 1) 128kb compressed size unit is not suitable for memory constraint >> workload, especially memory pressure scenarios, that amplify both I/Os >> and memory footprints (EROFS was initially optimized with 4KiB >> pclusters); > > Feel free to take another one at 2M THP [1]. > > [1] https://lore.kernel.org/lkml/20230418191313.268131-1-hannes@cmpxchg.org/ Honestly I don't catch your point here, does THP has some relationship with this? Almost all smartphones (but I don't know Chromebook honestly) didn't use THP at that time. >> >> 2) If you turn into a small compressed size (e.g. 4 KiB), some fs behaves >> ineffective since its on-disk compressed index isn't designed to be >> random accessed (another in-memory cache for random access) so you have >> to count one by one to calculate physical data offset if cache miss; >> >> 3) compressed data needs to take extra memory during I/O (especially >> low-ended devices) that makes the cases worse and our camera app >> workloads once cannot be properly launched under heavy memory pressure, >> but in order to keep user best experience we have to keep as many as >> apps active so that it's hard to kill apps directly. So inplace I/O + >> decompression is needed in addition to small compressed sizes for >> overall performance. > > Frankly nowadays I have no interest in running linux with <16M RAM for example. Our cases are tested on 2016-2018 devices under 3 to 6 GB memory if you take a glance at the original ATC paper, the page 9 (section 5.1) wrote: "However, it costed too much CPU and memory resources, and when trying to run a camera application, the phone froze for tens of seconds before it finally failed." I have no idea how 16M RAM here comes from but smartphones doesn't have such limited memory. In brief, if you runs few app, you have few problem. but as long as you keeps more apps in background (and running), then the memory will eventually suffer pressure. >> >> 4) If considering real-time performance, some algorithms are not quite >> suitable for extreme pressure cases; > > Neither in considering any perf under extreme memory pressure (16M or 64G RAM) > because of crystally pure waste of time. Personally I don't think so, if you'd like to land an effective compression approach for end users and avoid user complaints (app lagging, app frozen, etc). I think these all need to be considered in practice. Thanks, Gao Xiang >> >> etc. >> >> I could give more details on this year LSF/MM about this, although it's not >> a new topic and I'm not a Android guy now. > > Did you book the air ticket? How many bucks? >> >> [1] https://www.usenix.org/conference/atc19/presentation/gao >> >> Thanks, >> Gao Xiang