linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Sung-hun Kim <sfoon.kim@samsung.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	sungguk.na@samsung.com, sw0312.kim@samsung.com, sebuns@gmail.com,
	Stefan Roesch <shr@devkernel.io>
Subject: Re: [PATCH v2] mm: ksm: Consider the number of ksm_mm_slot in the general_profit calculation
Date: Thu, 20 Jun 2024 13:47:52 -0700	[thread overview]
Message-ID: <20240620134752.9a63c12403282c0c7e728764@linux-foundation.org> (raw)
In-Reply-To: <20240620043914.249768-1-sfoon.kim@samsung.com>

On Thu, 20 Jun 2024 13:39:14 +0900 Sung-hun Kim <sfoon.kim@samsung.com> wrote:

> The current version of KSM does not take into account the number of
> used ksm_mm_slot. Therefore, when users want to obtain profits of
> KSM, KSM omits the memory used for allocating ksm_mm_slots.
> 
> This patch introduces a new variable to keep track of the number of
> allocated ksm_mm_slots. By doing so, KSM will be able to provide a
> more accurate number of the gains made.
> 

By how much does the improve the accuracy?  In other words, how much
difference does this make?

> @@ -3672,7 +3680,8 @@ static ssize_t general_profit_show(struct kobject *kobj,
>  	long general_profit;
>  
>  	general_profit = (ksm_pages_sharing + atomic_long_read(&ksm_zero_pages)) * PAGE_SIZE -
> -				ksm_rmap_items * sizeof(struct ksm_rmap_item);
> +				ksm_rmap_items * sizeof(struct ksm_rmap_item) -
> +				atomic_long_read(&ksm_mm_slots) * sizeof(struct ksm_mm_slot);
>  
>  	return sysfs_emit(buf, "%ld\n", general_profit);

This assumes perfect slab packing, no?   Should it use ksize()?


  parent reply	other threads:[~2024-06-20 20:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240620043920epcas1p1b57dce789304aa96fd83e5b2b194d244@epcas1p1.samsung.com>
2024-06-20  4:39 ` Sung-hun Kim
2024-06-20 19:38   ` David Hildenbrand
2024-06-21  2:30     ` Chengming Zhou
2024-07-11  5:19     ` Sung-hun Kim
2024-07-11  6:32       ` Chengming Zhou
2024-06-20 20:47   ` Andrew Morton [this message]
2024-07-11  5:25     ` Sung-hun Kim
2024-07-11  6:10     ` Sung-hun Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240620134752.9a63c12403282c0c7e728764@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sebuns@gmail.com \
    --cc=sfoon.kim@samsung.com \
    --cc=shr@devkernel.io \
    --cc=sungguk.na@samsung.com \
    --cc=sw0312.kim@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox