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 C0DCEC4332F for ; Tue, 22 Nov 2022 12:14:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 443916B0071; Tue, 22 Nov 2022 07:14:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F2E66B0073; Tue, 22 Nov 2022 07:14:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2BC736B0074; Tue, 22 Nov 2022 07:14:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 1DF706B0071 for ; Tue, 22 Nov 2022 07:14:25 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D5CAFC0956 for ; Tue, 22 Nov 2022 12:14:24 +0000 (UTC) X-FDA: 80160970848.06.CA2B82F Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by imf11.hostedemail.com (Postfix) with ESMTP id A1DB34000A for ; Tue, 22 Nov 2022 12:14:23 +0000 (UTC) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id A5DD65FD11; Tue, 22 Nov 2022 15:14:21 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1669119261; bh=QsZAzuI9qBQHnlaxynSPsWNk5m9eu8gwQdPWrQGY0OI=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=pQjf9JAdqM4OgHzn+B5B9bAW63aFd1bKK54xEfxZiFwe5ClZhIrmS+ERR77j3d5gH q8JFNNSC7JnVz2SAcRBPnZzYKAdNrMjC14SRRJ7WlOYQFyLE12yXiKKDXWNAkouzzd UZmEndhKwc+Ne/4WMTbyw3bVrAQ/y2/S2gZJFY6SOqPRP+iPMSlpNcLpOIGUI4tgsV aoaj7Lm/oqyPFdsNDCs8spmR5GtU7TC2BcD1uZqg6kRCI2H9RSAHmhGhPiA8TJc2Rn La4w6eb+xq/Rcp6PY9YFJ7aW6Ct23tBMGTu70VNQp3l6gvUzssJRwlRgNF+pRkevbe VQS00m0DaIJog== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Tue, 22 Nov 2022 15:14:19 +0300 (MSK) From: Aleksey Romanov To: Sergey Senozhatsky CC: Johannes Weiner , "minchan@kernel.org" , "ngupta@vflare.org" , "akpm@linux-foundation.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , kernel , "Dmitry Rokosov" Subject: Re: [RFC PATCH v1 0/4] Introduce merge identical pages mechanism Thread-Topic: [RFC PATCH v1 0/4] Introduce merge identical pages mechanism Thread-Index: AQHY/duSaivivX4eVEi4n5R4teXteK5JpjKAgABo/ACAAAH8AIAAmLKA Date: Tue, 22 Nov 2022 12:14:19 +0000 Message-ID: <20221122121413.ssieckg523urj37h@cab-wsm-0029881.lan> References: <20221121190020.66548-1-avromanov@sberdevices.ru> In-Reply-To: Accept-Language: ru-RU, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.1.12] Content-Type: text/plain; charset="us-ascii" Content-ID: <9FF7E9E2A2A16F438D29FD93C6512969@sberdevices.ru> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2022/11/22 08:14:00 #20597802 X-KSMG-AntiVirus-Status: Clean, skipped ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669119264; a=rsa-sha256; cv=none; b=H9cOTTqwjIUgU3n98jo1RQtcNUGv67tZg5sXNBUshHCIMB0sOfvBcBxA2xGpotC8iZrExx zI8FCPyMZczPcLCS2+JULhL6NwbooALSHkTfafkn9HLP+ObZeydc9f8s+wH99MlCRJobx+ cSWetL3jDl0Uyf85rL1q48B5yp09LCU= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=sberdevices.ru header.s=mail header.b=pQjf9JAd; dmarc=pass (policy=quarantine) header.from=sberdevices.ru; spf=pass (imf11.hostedemail.com: domain of AVRomanov@sberdevices.ru designates 45.89.227.171 as permitted sender) smtp.mailfrom=AVRomanov@sberdevices.ru ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669119264; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QsZAzuI9qBQHnlaxynSPsWNk5m9eu8gwQdPWrQGY0OI=; b=0GD2rJHFZ43sBAVj/PhqyhTFo2xLcwMMN4MGuI5jpWGipvsPhF/7idSgnDIvGKYUJuYDPY NTVH1tRXN9yIozIVERNaSh0sqWFTVLxwQCb2O+n70cfhCSRym6nbs+Sx6RZTjl9U5HFquR oewGhpJe+d0DDzOuyhAsxtT7IscrDnU= Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=sberdevices.ru header.s=mail header.b=pQjf9JAd; dmarc=pass (policy=quarantine) header.from=sberdevices.ru; spf=pass (imf11.hostedemail.com: domain of AVRomanov@sberdevices.ru designates 45.89.227.171 as permitted sender) smtp.mailfrom=AVRomanov@sberdevices.ru X-Stat-Signature: 981tk4kdq9kxcgmgwx8akrgodqb4878m X-Rspamd-Queue-Id: A1DB34000A X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1669119263-977341 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: Hello! On Tue, Nov 22, 2022 at 12:07:42PM +0900, Sergey Senozhatsky wrote: > On (22/11/22 12:00), Sergey Senozhatsky wrote: > > On (22/11/21 15:44), Johannes Weiner wrote: > > > This looks pretty great. > > >=20 > > > However, I'm curious why it's specific to zram, and not part of > > > zsmalloc? That way zswap would benefit as well, without having to > > > duplicate the implementation. This happened for example with > > > page_same_filled() and zswap_is_page_same_filled(). > > >=20 > > > It's zsmalloc's job to store content efficiently, so couldn't this > > > feature (just like the page_same_filled one) be an optimization that > > > zsmalloc does transparently for all its users? > >=20 > > Yea, that's a much needed functionality, but things may be "complicated= ". > > We had that KSM-ish thing in the past in zram. Very briefly as we quick= ly > > found out that the idea was patented by some company in China and we co= uldn't > > figure our if it was safe to land that code upstream. So we ended up dr= opping > > the patches. > >=20 > > https://lore.kernel.org/lkml/1494556204-25796-1-git-send-email-iamjoons= oo.kim@lge.com/ >=20 > IIRC that was patent in question: >=20 > https://patentimages.storage.googleapis.com/e2/66/9e/0ddbfae5c182ac/US997= 7598.pdf I think the patent is talking about "mapping the virtual address" (like in KSM). But zram works with the "handle" abstraction, which is a boxed pointer to the required object. I think my implementation and the patent is slightly different.=20 Also, the patent speaks of "compressing" pages. In this case, we can add zs_merge() function (like zs_compact()), that is, remove the merge logic at the allocator level. zsmalloc doesn't say anything about what objects it can work with. Implementation at the zsmalloc level is possible, though more complicated that at the zram level.=20 I believe that we can implement at least one of the options I proposed. What do you think? --=20 Thank you, Alexey=