lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0fe601dad352$cca07de0$65e179a0$@samsung.com>
Date: Thu, 11 Jul 2024 14:25:53 +0900
From: "Sung-hun Kim" <sfoon.kim@...sung.com>
To: "'Andrew Morton'" <akpm@...ux-foundation.org>
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?
> 

I think it makes only small difference. (few kilobytes for hundreds of processes)


> > @@ -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()?

Ah, thanks for your recommendation. It should be fixed.


Best regards,
Sung-hun Kim


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ