[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240620134752.9a63c12403282c0c7e728764@linux-foundation.org>
Date: Thu, 20 Jun 2024 13:47:52 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Sung-hun Kim <sfoon.kim@...sung.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
sungguk.na@...sung.com, sw0312.kim@...sung.com, sebuns@...il.com, Stefan
Roesch <shr@...kernel.io>
Subject: Re: [PATCH v2] mm: ksm: Consider the number of ksm_mm_slot in the
general_profit calculation
On Thu, 20 Jun 2024 13:39:14 +0900 Sung-hun Kim <sfoon.kim@...sung.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()?
Powered by blists - more mailing lists