From patchwork Thu May 25 21:43:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13255702 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 B3EEAC7EE2C for ; Thu, 25 May 2023 21:43:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C1FF3900008; Thu, 25 May 2023 17:43:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B82B9900006; Thu, 25 May 2023 17:43:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A49F9900008; Thu, 25 May 2023 17:43:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8AFFC900006 for ; Thu, 25 May 2023 17:43:29 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 52D2540B95 for ; Thu, 25 May 2023 21:43:29 +0000 (UTC) X-FDA: 80830104138.08.EAD3103 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf07.hostedemail.com (Postfix) with ESMTP id 79F3140010 for ; Thu, 25 May 2023 21:43:26 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=nzbBk6KC; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf07.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=1685051007; a=rsa-sha256; cv=none; b=LLKx/wBnZx0yqEWKsePt1hAmkkF6e9Oc2MY3bbXzo5l4+VPAdQM1yNR1JdrKocedqdC9fz nr2VJF5hOGppxRnolM9q6aaQ6io4nREoMJvTb+m2eQDKfCwy0P9D44b2bctWjfTLzoNseH sZyUy5A0/vi515iaR4cFhJFCQvSTWws= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=nzbBk6KC; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf07.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=1685051007; 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=I6GWwUgfbn7yeMpa/l9FEN4Tg3PHGkeps/QvA310OWs=; b=j3SfPmJHcLn9eS/8OCsSGU/5ibpguED38giFZQ+I6dXIej1DVeDC31gcv4KTS0l4/IuYgX 3mLumxqDCSi8F/qy8wmNbFR3udBPWveV74KKffiGtrD0u8jia7p5Qh7F7kyghMVIEKFU4v AAqgXPQ0ER6mRQOTMApgvD4XoCr503U= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B72E564B71; Thu, 25 May 2023 21:43:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C31EC4339E; Thu, 25 May 2023 21:43:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685051006; bh=APr09IDiXGykzuGGa19YHF7doztMwWo2QuV04whzSE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nzbBk6KCaeEKjgaCqUIVU5hTiLijuoQ2H2aJfAUzxi/UVr0w7ei8EnEamotAgKXfL 1JF/RgO5UylZl9FlBIpP399R6mpJfXhfU8jx72dyC0YDzfWvAjkDaf22nyQ9VIRqeY Xc1e1uEfUPDeYFysPQ5t9qDZVJhWXzg5djp9FRE5fSGQuimSe0YWEqmJwuoR1rQPUG G6i6YnbO3iJYJqgyTvJVVAByL5/4lUEU039yAGDyAX0TIFjzqJFJatQ/no1KeLwdNx G84vkoXyWM1gRPfQVIfhW57qQ2wnQ8HyVM7PXxMOYP2YxHQXN6+/hlIyR+gXywy4Pt niR+/fxAA9vmw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/10] Docs/mm/damon/design: add sections for basic parts of DAMOS Date: Thu, 25 May 2023 21:43:11 +0000 Message-Id: <20230525214314.5204-8-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525214314.5204-1-sj@kernel.org> References: <20230525214314.5204-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 79F3140010 X-Stat-Signature: hucs7nioghqua6yxiggyw5fy7mx8msf9 X-HE-Tag: 1685051006-360252 X-HE-Meta: U2FsdGVkX1/9JVrWkMP2uhQKQiBcK6l9Z81kEVqox2NYlP2IZDB3oFm8m18K2vowMvXXCinuzV2ONFYu3ximjcKr9sH0HD1SJn5x0PkPqyMBfYfOzNTcSDOrl48kruAL1Y0xp3WwcLXjPlyZfUq2jOcaX9I9E0F7zloMpcgp6v3egXe3TrVt7n2JpVx/Dnn3rrSllITVLbXljplPljuCgmgsEo3y7Pdj9EYnEUDSrukhRV++d7JjMOZfNbRoYNDEzHMA4mzurga5mybvURficIUEHPwiEvXJERv5DbLD8PpWlBk38XLjVbSu919OSvj2UQwYHQTsEhdHW3574UCyDwrZGjPqCp1xgJVRTxbEO/XQCeIzXgAr2JlfJRl7nEqYGytxKawaz7sJOJGB4tKI2pF/gpQFXkLd0nd+YLeqrnWqhzutp4doTJ2VLNGRLrkUrdtETLXJ0HvCBzZfuOmF4B9MY60ZKbF0veioQ839791OgO1o2PtrtzMhbMZcS+/v7UUol/nkRycRaTogJTDOudXe3geC6gLQpueFfzMvO0RAPD6CknuVMyq5FlzccRzioEjSqvyYU1H4wWHD2WkJFIl+wBWuYe3gJXb5wtx+gyWP7m53gSnAyIxjFux6BMQk9wVZ04gAEYNIz2RwmpbUDr5vwIVOyUtkLu5ETPHv43prS+Oy25WvujjI1TOvlL767aozRZVQkofO6wLXHF+ksW+84WNLvMJqo9P1+gxiAQ+hI/jBlRBeq7HolBzeC90062ygLnVH0UsZloR1qvo4JA69HdO7siGfbftk1Md7od/axEiziCGN2uL6r/nE2XKuLgALsZdgPz9fk3PSIq8AtM2XAUVLycDRT2LevuRBznOCw+lYT5/Or/WMJodb73219N+OyRFpv6E62KO7exr5PG54Rb6cQXiPxKYnAZQiIkj0ednGQPNczzX1qOYe1qgQyAXkpPL96MD2iax5bGd mmlSfdd/ wWHkFErIOEJ7vptIqBz0LT71eNtrrPSYZclaAAy+9n/E5ZJ37h9dEjEynRyi0EHuYt/Sj8TYNl+uJaexqhNdJRkA16iEB0Cp5lCwiQA/sdKPIJ2s+/5+LCzVH9Il8CUzRUIOrqXFPK2f5wLgB0D2/sfq2Yf40TafclFfdWj9+WN55vIxS2g9w01XioB5sk0iU05AyyVGrkw3/UrrBIsmOTG09iWUreVbvjb+1HNXYeBhrJYt6MWAcpM/J7WxeKEKP/+4/iVocbAFvd0fx+CfYYYI1/UQs4rrxIZq/escRF6oBDxkCjjJ08+gtaTKHKdvQg4s5//yAhxTgkrZqdJnxSR8w1jStP2nfN/T8JPFTnB+IpISpFEpMbKU/HmPyg/vH6Xlw 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: DAMOS is an important part of DAMON, but the design doc is not covering it. Add sections for covering the basic part of DAMOS. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 41abd0430dd7..9f9253529c3d 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -202,3 +202,73 @@ monitoring operations to check dynamic changes including memory mapping changes and applies it to monitoring operations-related data structures such as the abstracted monitoring target memory area only for each of a user-specified time interval (``update interval``). + + +Operation Schemes +----------------- + +One common purpose of data access monitoring is access-aware system efficiency +optimizations. For example, + + paging out memory regions that are not accessed for more than two minutes + +or + + using THP for memory regions that are larger than 2 MiB and showing a high + access frequency for more than one minute. + +One straightforward approach for such schemes would be profile-guided +optimizations. That is, getting data access monitoring results of the +workloads or the system using DAMON, finding memory regions of special +characteristics by profiling the monitoring results, and making system +operation changes for the regions. The changes could be made by modifying or +providing advice to the software (the application and/or the kernel), or +reconfiguring the hardware. Both offline and online approaches could be +available. + +Among those, providing advice to the kernel at runtime would be flexible and +effective, and therefore widely be used. However, implementing such schemes +could impose unnecessary redundancy and inefficiency. The profiling could be +redundant if the type of interest is common. Exchanging the information +including monitoring results and operation advice between kernel and user +spaces could be inefficient. + +To allow users to reduce such redundancy and inefficiencies by offloading the +works, DAMON provides a feature called Data Access Monitoring-based Operation +Schemes (DAMOS). It lets users specify their desired schemes at a high +level. For such specifications, DAMON starts monitoring, finds regions having +the access pattern of interest, and applies the user-desired operation actions +to the regions as soon as found. + + +Operation Action +~~~~~~~~~~~~~~~~ + +The management action that the users desire to apply to the regions of their +interest. For example, paging out, prioritizing for next reclamation victim +selection, advising ``khugepaged`` to collapse or split, or doing nothing but +collecting statistics of the regions. + +The list of supported actions is defined in DAMOS, but the implementation of +each action is in the DAMON operations set layer because the implementation +normally depends on the monitoring target address space. For example, the code +for paging specific virtual address ranges out would be different from that for +physical address ranges. And the monitoring operations implementation sets are +not mandated to support all actions of the list. Hence, the availability of +specific DAMOS action depends on what operations set is selected to be used +together. + +Applying an action to a region is considered as changing the region's +characteristics. Hence, DAMOS resets the age of regions when an action is +applied to those. + + +Target Access Pattern +~~~~~~~~~~~~~~~~~~~~~ + +The access pattern of the schemes' interest. The patterns are constructed with +the properties that DAMON's monitoring results provide, specifically the size, +the access frequency, and the age. Users can describe their access pattern of +interest by setting minimum and maximum values of the three properties. If a +region's three properties are in the ranges, DAMOS classifies it as one of the +regions that the scheme is having an interest in.