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 29952C4167B for ; Wed, 29 Nov 2023 17:11:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B8A0E6B034B; Wed, 29 Nov 2023 12:11:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B3AA06B03DF; Wed, 29 Nov 2023 12:11:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A2A036B03E0; Wed, 29 Nov 2023 12:11:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 90ECE6B034B for ; Wed, 29 Nov 2023 12:11:04 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5E5401C017E for ; Wed, 29 Nov 2023 17:11:04 +0000 (UTC) X-FDA: 81511632048.10.77787ED Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id 890F41A000E for ; Wed, 29 Nov 2023 17:11:02 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Ju5lIPl8; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701277862; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9i8TOhKDD39p2qqaWWbF+fs+NZdDPkxbnXeU7tCrEyA=; b=6d2N8iSG0dfPoRm1ok6S+48uC2sd8TG68dl0aRk1PRQjkELVRVaFnRaj9zSfy+ORgGmf0c QMU932B+UcWNnf1iu5xrhRBp/w5XF9j1awZiA8NNcy723k9i6EExH5xhASWeJ48h3HnrMX wA05TprhGkrhqpuZu/wcq8StelrRLfw= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Ju5lIPl8; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701277862; a=rsa-sha256; cv=none; b=LXrRku5tcRgP49SJFiwZhdwyAObErGI1xkEyjzW/8Gonw7HKChkUA/yNdt5lH8EDb4dlGp FuUtceEwhOpFJ47H6Ve8YhrQ3aPNhyUz/HqsvznMOo0KMYf/ZMi9FrvHPb5hXSzBkEA/Qf XRyEnLY5K/iD+YunE0GBorFMXc+2gsQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 7DE2661CBA; Wed, 29 Nov 2023 17:11:01 +0000 (UTC) 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-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 890F41A000E X-Stat-Signature: h69pfn3zmtf8p8kb96yb9xfn3jsdaype X-Rspam-User: X-HE-Tag: 1701277862-501458 X-HE-Meta: U2FsdGVkX19mUm0itxYlP3VRZGLzzJSa6bs4V9SSCJzGbUlamWDf8QVEIiDn0oM7111Q5aS9SFC67cY00tRDMNrKTpi/XWYOxJ8Lw+OUO9wQactg+jJpnn3EgwNsFKIvWr5jokZyNnPLij3C48A7L26sHwL/x75pedlaz3i8/Y0+j3+plfhuIue1kniBuwmiBPXJup2dRVceYE3datL/p6RJD3WnmpAbadLZZiVhozEKB8gkR9T3hNOltoNgumGFXv2bxMD/FPjl7JM5OTG/ciavDTejnO6ya9LljIhohCK/z0RUTSYTEGO8NkkGZmKj6Rn2eaptYxAt1OWiABvaZttweQnIJbf+mcvTeXG68+j7hi9CJNZATGywgwALH0O8Mpq6OQEnT+f26J8SvOi74xcI77gfZQrJn44+ZSF4430kijV/niM0820l7xqJxfnwJ0UOZucKLcCqQyr1D7dbc1FANcECMCmZJKpneOOHSwSllkp8kyfiTNlUwPk6LgWPP60j7ubLDx02/uOJdaN4ZmwXXXaIhTx/Zlnf8Risqomab5MpRV9RNReECQzW23yPvev7tiLjVbxi+JKTBAh9T+3QqKOGy/wQk2Z5WzkpumsDTjv0IyRfWpVXWnN+23ajL1z47/u+ynfghNOA/jc5FhVYFjsEVPyPdAdfsvf4fyxwNs9jtVC16tIW9Ol2Ui04BJdRrxLxzTzv238uTEV8LcOSqui3Y1Y2gNtNju64I1r8cZypqv0tSdjXpCMHJfy+bT+S51F7lWH3lNif7+HCSWs3ZWmL1yy+fUcRu9sacJOjGJeXSIPCDJg7NmY9ZaGeq3LvIhX/AhcR5LNkzrPoia6tTDnuc8KTwIlTzivKDc8LR2gcarYrw7Vvw8aLkzrxL9sJKz4Dzr1b7zxC4NW7B20QTlEsX36NfJwCTwRjERN3pOdIPlqcJ9IeJpMRKZlRcCjW5U6AreKYCWTtqgx gNhLQWD0 3aFUr5UbDghPUMMFiUjNlJLXMTxc9CCYvBrJQ3hO1ztZaMe5x6ifKiJWi999avdcSWxlmX2Nt53lFrOrB2/qjCyS1tIS+ddb1YOgjppbWRKOntiwk8GZmcPPHffMdyYoPxXtnRHxvyqpGX47hq5laEIvq8s780rCLyQDKw+xRbLoS/0MCoK/9qI5kUaepO1KS7hDZ4EnEruCqOEl/VIZzUgKyrWmX/prqkFh+3a4jYAb11HoVJqlzcECtIFY6YvPOvWAousYL2NcOV4c2iGP7JkAwS7crpysclq1a X-Bogosity: Ham, tests=bogofilter, spamicity=0.004367, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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. > [...]