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 D4063C4167B for ; Fri, 1 Dec 2023 12:25:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 268EB8D0070; Fri, 1 Dec 2023 07:25:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2190B8D0001; Fri, 1 Dec 2023 07:25:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0E1A68D0070; Fri, 1 Dec 2023 07:25:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id F01BA8D0001 for ; Fri, 1 Dec 2023 07:25:15 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C1C88801C9 for ; Fri, 1 Dec 2023 12:25:15 +0000 (UTC) X-FDA: 81518169390.09.7B6DDB5 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf18.hostedemail.com (Postfix) with ESMTP id E8E091C000B for ; Fri, 1 Dec 2023 12:25:13 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=VaBhoqJ2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of cuiyangpei@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=cuiyangpei@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701433514; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vFLb7KVsw6jFSNkRuQETVY19rXhRyG8eEk4pj82LTQI=; b=NKB7LgVnkuhgMIRLvhzupIMH93U/AbLCGIRK69yRrfzykcvi2vkjKwB62cLNppuzS0ZWY4 CrOZAmds9A6UZ/OcyO87ZBRAoPuyq7p+KDaolYm9gOXlyUUdAoB7ibfadsHWetu1bKi5aV 1yBuEKTA438QSNC4xZaCbqLLscpeGhY= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=VaBhoqJ2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of cuiyangpei@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=cuiyangpei@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701433514; a=rsa-sha256; cv=none; b=ZkNi4BfZu85EGNK2sCGjNz/wt2o1mKCv6Ip7amOXvxSie3TyO0Sq6K/XjWzq8bMYlttubD thP4vd9NWIowpmd7BknH0Bshegakx0AbttUYcIDrsjYPJl8w6ov0be0j+0NkRzckN4Yx/y ek/JFcTKxu2USyEhhNNGjdC7gW0hmYA= Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1d03bcf27e9so3938085ad.0 for ; Fri, 01 Dec 2023 04:25:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701433513; x=1702038313; darn=kvack.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=vFLb7KVsw6jFSNkRuQETVY19rXhRyG8eEk4pj82LTQI=; b=VaBhoqJ2cNAcDyVzP1n5fHxl7JTSuJYH6pBWZtmL45tOwwCGh691GHjVzY9OzCUwQY OjD3Mt9mH1Tt8tK/NH5MlKxs4fb8z7EL6fNAWB0sr8AyfE9Uf7gdmNhdR5sfc9xJYAFd tDZYYKaqhk1BkbO8bHFO1LEBVua+dQP+eqtwWnczhsekFgJu8SWGiYtk0S4dq9EWsPm9 FyLWSQ+QUMYUfOD26MODBzd26upcM6N8qUFlMx0dJro1qp3v2YtGXfEYO4U7PfJ+nnri CjFoF+R4/lRaCAQ2vUmLDcF5yvG1DzNyHoF3hQdy+s7RfRpOBnxSUFVim7i6xNWY7J8j 1IQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701433513; x=1702038313; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vFLb7KVsw6jFSNkRuQETVY19rXhRyG8eEk4pj82LTQI=; b=Sg+YyUVyy8fbETZThyv+lNb0zKb12q1K8HKGmYgDONsd+k2Yi1OvGUqJ0+Es0wZ0Su nEIzhpZBuFL67Etb+99BFf6tmiz62PzFtSO8ErjQyH1FzjLqJ9IofZr3jZ5c7nnhdagc acg1Cidr6bNqgpCS8cl6FSz2EBbafujF8DDAraFZd05V8kmf70L9VDFTFE5rRRCeiPMJ 5QXo0VFf+wGAQX9VSB0OLKm64bcE0jvF48WkP/dX0nZsthvAJE5fkue6Jra9G0+ff15P Po9i0x4JIDQzSezTVUI86ZJnhnNEfE/KTc4YFa9HEP/UQOxuomoA5uwlWIKfy0tRF0EX W2YA== X-Gm-Message-State: AOJu0YxDdX/y3QcEftl7uyEB3VRfUnJKVUM8cHkG4TvOThnop7E9XaW/ 0dU71Tjq4cExltOPcLI+y/I= X-Google-Smtp-Source: AGHT+IGwHjW8ph1E++zlfVk58m5vvGNHyejPxcXVReGB+FDfMZvDbQ7ctLqTN3OYTS2OGZHVQSIrgA== X-Received: by 2002:a17:903:445:b0:1d0:5db3:7791 with SMTP id iw5-20020a170903044500b001d05db37791mr661485plb.63.1701433512659; Fri, 01 Dec 2023 04:25:12 -0800 (PST) Received: from cuiyangpei ([43.224.245.227]) by smtp.gmail.com with ESMTPSA id f7-20020a170902684700b001cfacc54674sm3250857pln.106.2023.12.01.04.25.10 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Dec 2023 04:25:12 -0800 (PST) Date: Fri, 1 Dec 2023 20:25:07 +0800 From: cuiyangpei To: SeongJae Park , akpm@linux-foundation.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: xiongping1@xiaomi.com Subject: Re: [PATCH 1/2] mm/damon/sysfs: Implement recording feature Message-ID: <20231201122507.GA15806@cuiyangpei> References: <20231130091426.GA13946@cuiyangpei> <20231130194420.51355-1-sj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231130194420.51355-1-sj@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: E8E091C000B X-Stat-Signature: kynorbtc1bfd8ey7et3n863m7m75n3mu X-Rspam-User: X-HE-Tag: 1701433513-45275 X-HE-Meta: U2FsdGVkX19RnUC4N69sC6hayySTknFs2QL1o078YwyuwG1/fnO06OPqXPg0vY8D2QwOuoRkSEm73kk7OkVFY+3gg20wWKIgjZUyGhTo5HaGOIEY0IDMLBJ44aTNmrTchFLseC185V4insJVdWLX/WOpEATXxGlfQ+xthcUnU2sL+fHLNEDcUOzUKj1KoJBUebP9ppvuYrnau/Zc19biBQ2WZvUWGp75USt9Hi+atYYS3Yi1I16RhE+1ruj29lgtFvNloVW/XSKmyh1+SjfZ0HeP1fPNyqMIeb5myahIPvvZwWKLtTMMZpIYZdEBbfaL307sXBWxMF2p7aT+LOP2iWChlernPPKikTnviseCPFaRJD8NQvuKt5Qjl7r1OJLR0sGS8dJRnlYqZx8+HHFwWnhzUCoQQ6jwAMQ/ciUrlXdjQg8r7ivbdFvaQIX4bHZ2FoEFEp4/76O8gFiPvFWuLfi4zL5YKbnn5jYpsIsvSsCNxSnaezSxGHJ2Is9m0BXK/9uNCnCJEXi/MjtTZNdEQUswOSDThvQ30/k/EjzMqglWIlWucDdFnk35x6qyEm//s5+BkLziGcHDU/bESWDPfKm4htvJno3JUpJB4aCGupFI8WsqqXJUsBxCeu/b7Ki6GvksPL3iYGYIC7S+iHBXogIlCLOpLeeE+KEW0goZ59mht79HlUzGpF+2WdHQBuVO7a4k47RQjWflFjEokfzE+J+MnuIROYtAwhyYAB/Xys1okn2z+kSmRXw2ZvT7EbvTScavvdPoHn0a2u1ynf5n/u+4pyy+wSbnbm1BjbShVssRXgN9SR07S+kw0UK73CEIvkO5uaRY8REwq3WKFTwnSRelWujeDX0ygTOfqsFiD/4/GmlEi4VUEAI0vBwaaykoJ+kKltAgFdiv+53eU7qxOw+IltoGbaCJPwxPImrb7H2PN6ysSW7Fz8Ps9z0gPxtoHXMBI1pDAigTypkxx33 E7fIbX/D UoG2F1jd6RgP+9/aDgSL9u1n44aeYgz4Gl/7tCJ2OkFb+63Qp5D0t0rc1G4UKmcKrDnxX/GHFPPy/Mwz3hNXdeGTQ/3ZiWwg1hfX6PudQC9fjyRWYlFtBh0r1TzWImpSrKOkmZBNuwMUxMM1mfVafel51F3qeRHXph5IQzblGHQq41usDnWI/0MFBI8HZnLkJg5EM3quWAc5pziWWyy31YTJPvqbfNoi62u3x7GVkP3rkYIetDlpxHlssoQX10gyHxMIjJ/+PGhLykR/DhYaauvDHH1lkEsHQL59WaTjZxZ+X1+9B7UtNlP7IO9AmeFZdlMm5Js1rOmZmZ0KMv24HOHCxcxijuzbODPFgcfsk6qy8oC2+xX0dHEC85KtaRaLrengvBacsQAfMF80z4vb0/ZpLsUhfrxvKthZXo+5XejqlTXqv9zx9QK7KRxFUVERUrrAee59OWzgUxSOwFitOzC6jqM69uPWfDXQpPCSYWlsn6ETDWxvYxL6Ulg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.078114, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Nov 30, 2023 at 07:44:20PM +0000, SeongJae Park wrote: > Hi Cuiyangpei, > > On Thu, 30 Nov 2023 17:14:26 +0800 cuiyangpei wrote: > > > Hi SeongJae, > > > > We also investigated the operation schemes you mentioned, but we don't > > think it can fit our needs. > > > > On android, user will open many apps and switch between these apps as > > needs. We hope to monitor apps' memory access only when they are on > > foreground and record the memory access pattern when they are switched > > to the background. > > > > When avaliable memory reaches a threshold, we will use these access > > patterns with some strategies to recognize those memory that will have > > little impact on user experience and to reclaim them proactively. > > > > I'm not sure I have clarified it clearly, if you still have questions > > on this, please let us know. > > So, to my understanding, you expect applications may keep similar access > pattern when they are in foreground, but have a different, less aggressive > access pattern in background, and therefore reclaim memory based on the > foreground-access pattern, right? > Different apps may have different access pattern. On android, the apps will join in freeze cgroup and be frozen after switch to the background. So we monitor apps' memory access only when they are in foreground. > Very interesting idea, thank you for sharing! > > Then, yes, I agree current DAMOS might not that helpful for the situation, and > this record feature could be useful for your case. > > That said, do you really need full recording of the monitoring results? If > not, DAMOS provides DAMOS tried regions feature[1], which allows users get the > monitoring results snapshot that include both frequency and recency of all > regions in an efficient way. If single snapshot is not having enough > information for you, you could collect multiple snapshots. > > You mentioned absence of Python on Android as a blocker of DAMOS use on the > previous reply[2], but DAMOS tried regions feature is not depend on tracepoints > or Python. > > Of course, I think you might already surveyed it but found some problems. > Could you please share that in detail if so? > DAMOS tried regions feature you mentioned is not fully applicable. It needs to apply schemes on regions. There is no available scheme we can use for our use case. What we need is to return regions with access frequency and recency to userspace for later use. > [1] https://docs.kernel.org/admin-guide/mm/damon/usage.html#schemes-n-tried-regions > [2] https://lore.kernel.org/damon/20231129131315.GB12957@cuiyangpei/ > > > Thanks, > SJ > > > > > Thanks.