Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4735232rdh; Wed, 29 Nov 2023 09:11:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcuplUxK4mQQOoHf2V8T3psOH0jRJf8MzJsMAsHjythiwFBlrYyBv0KeRo3zSkus82qxQV X-Received: by 2002:a17:90b:38d2:b0:285:b99a:a92d with SMTP id nn18-20020a17090b38d200b00285b99aa92dmr13290954pjb.32.1701277874913; Wed, 29 Nov 2023 09:11:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701277874; cv=none; d=google.com; s=arc-20160816; b=nyE78mEBFrcByFq/2Af7KQkelwHFhEOs+JzzRm5EsTxQN7M/TyCv2hOZnBzTqWPw6I MZ88tvM04O/k4nrz2qOgEoD2CVCrsvyPO1XKyAcPwueZC/bYLxVSdCnQZYSscTcx1+5T f2kLwwWkdyDGl5RSGG5K4RZQ69Ws9a9p2F8bx9dVmeXtFw8t62lCqsOYIxhJFA+Dqxhe sfbAGGonGrG269qaOVhAL69YqLV3Q/SlzYYl/Tq0jRbtDS44CSHxHIZ4L4jCgaTVDA6/ subjOhh5BsKlDso9HUCWW7ZpbZLYzQXP94NHXikl7zAShXNVmh4t7sIXhInDbXO8LiY0 LIsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9i8TOhKDD39p2qqaWWbF+fs+NZdDPkxbnXeU7tCrEyA=; fh=UfQOkad9c7itxlc2aN206qkrnbaxAD6j72EGLuO7fjo=; b=H2f8NIz1AAhVnlvz0HUBlzhobympgyXgf+Mn/PR+hCaPAcKpOreajvdZHHXnjVeo8G cMJMgKe/V0+6/zq+j0a1bEwRzXHlEyo7PtSVJJXg/Cb8peHvAq3RFOiqHHOuhwZq4A/s DUM5I1tEiCbZDgurI3qWa481f/vjrxGzo0DojqpoSROTf3GD4PtKW0/UOU5eb6hNtZV0 E/1kBpkIrY2wK7L+JOTOb+5kar5L58B6STrsQC5BStYiTHYcobeIUujtMBO5DcKTIqqW nNK7Cxc7KJ8STq4UyLXk44nbS9j700IQZWSUhMB4oiU3a3JV1gMTG8RTSinGh/DNPuCh V6yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ju5lIPl8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id cq12-20020a17090af98c00b00276b35bc424si1683750pjb.26.2023.11.29.09.11.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 09:11:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ju5lIPl8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C579780B8169; Wed, 29 Nov 2023 09:11:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229509AbjK2RK4 (ORCPT + 99 others); Wed, 29 Nov 2023 12:10:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230511AbjK2RKz (ORCPT ); Wed, 29 Nov 2023 12:10:55 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84B4ABE for ; Wed, 29 Nov 2023 09:11:01 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95CC7C433C7; Wed, 29 Nov 2023 17:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701277861; bh=yIXGLLFPFr7RBt5CQB+D2IWUlHsvbAOtG6RShF9Nrwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ju5lIPl8700Nv3qzxPV7UcGNDOgnOBw10xs3PDmKLU1N19XY2sCB2JL7mMotDL7cE 76TEzHH0dlmdSiTQgo/3ILWaYuAFX9ttFRDZbIftUv/iOiOKQTM2ZhqtWAoPseuTVo gZlhtiNJYxUHAplk4TLz/36JxT5YKuaNStiIUn6Zqg+yg1pAx877b2uJMs8NnwfZe5 664nYl7NrhLEMW4j+FNEa+EGi7LXf/1dROyqciMLLQEIAN+X2Dofctl/M9+B/SfnZD iepu33luDFkkXwGNuA4FAtX7cH+ehzAmqlD3Zc4s1pn6TQBwgwOrVb+y45Of+AFXkb OxVaUdOX+uZ0w== From: SeongJae Park To: cuiyangpei Cc: SeongJae Park , akpm@linux-foundation.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, xiongping1@xiaomi.com Subject: Re: [PATCH 1/2] mm/damon/sysfs: Implement recording feature Date: Wed, 29 Nov 2023 17:10:58 +0000 Message-Id: <20231129171058.50270-1-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231129131315.GB12957@cuiyangpei> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 29 Nov 2023 09:11:11 -0800 (PST) Hi Cuiyangpei, On Wed, 29 Nov 2023 21:13:15 +0800 cuiyangpei wrote: > Hi SeongJae, > > We are using damon on the Android operating system. It starts monitoring > when app comes to the foreground, stops monitoring and save the > monitoring results when app goes to the background. Thank you so much for sharing this detailed use case. This will be very helpful for us at understanding real usage of DAMON and making it better for that together. > > The two methods that you mentioned, > > 1.tracepoint events > This method requires opening the tracepoint event and using the > 'perf-record' tool to generate the perf.data file. Then parsing the > perf.data file. However, the user's phone is not enabled tracepoint > events. Additionally, the generated file is quite complex, and we only > need memory addresses and access frequency informations. That's fair points, thank you for kindly explaining this. > > 2. damos > There is no direct Python runtime environment on android phones. > > Both of these methods provide results that are not very intuitive and > require complex parsing. We save the results in the format of starting > address, region size, and access frequency. When the available memory > reaches a threshold, the user space reclaim memory with low access > frequency by calling 'process_madvise' function. Again, very fair points. So, if I understood correctly, you want to reclaim cold pages proactively when the available memory reaches a threshold, right? DAMON could do that directly instead of you[1]. Using that, you don't need to save the access pattern and parse but just ask DAMON to find memory regions of specific access frequency range and reclaim. Have you also considered using that but found some problems? I understand the feature may not perfectly fit for your use case, and I want to learn from you how it could be better. [1] https://docs.kernel.org/mm/damon/design.html#operation-schemes Thanks, SJ > > Thanks. > [...]