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 4275FC433F5 for ; Thu, 12 May 2022 22:37:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B657F6B0073; Thu, 12 May 2022 18:37:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AEE4C6B0074; Thu, 12 May 2022 18:37:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 98E0A6B0078; Thu, 12 May 2022 18:37:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8538D6B0073 for ; Thu, 12 May 2022 18:37:56 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 4EF1231B95 for ; Thu, 12 May 2022 22:37:56 +0000 (UTC) X-FDA: 79458554952.06.8B97A34 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf14.hostedemail.com (Postfix) with ESMTP id 853BB1000AC for ; Thu, 12 May 2022 22:37:53 +0000 (UTC) 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 0810061F5E; Thu, 12 May 2022 22:37:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 049ACC385B8; Thu, 12 May 2022 22:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1652395074; bh=iXYbrakwOy8fAS30CpfPw/fAsO6kge5ixveO1uxKU/I=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PMBURyUly2UezZiNvUykZHn33IlAWIMcuk7bTxPjWZyZ3Ag10LKIXURsFE3JF4NJx SYgAhZDbYdpgl394L62xDISq1OGnn8EsEJqmcO3utNvrphDGTsPxMz/vc6xBZydBrT YORPRsmlAVMS5yX+P3jHKm16rK21uDwj7kqO7/IU= Date: Thu, 12 May 2022 15:37:53 -0700 From: Andrew Morton To: Oleksandr Natalenko Cc: cgel.zte@gmail.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, corbet@lwn.net, xu xin , Yang Yang , Ran Xiaokai , wangyong , Yunkai Zhang , Matthew Wilcox Subject: Re: [PATCH v6] mm/ksm: introduce ksm_force for each process Message-Id: <20220512153753.6f999fa8f5519753d43b8fd5@linux-foundation.org> In-Reply-To: <5820954.lOV4Wx5bFT@natalenko.name> References: <20220510122242.1380536-1-xu.xin16@zte.com.cn> <5820954.lOV4Wx5bFT@natalenko.name> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Stat-Signature: ifxan8n9fpbo8bs4hci31bw7rtb3sgcn X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 853BB1000AC X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=PMBURyUl; dmarc=none; spf=pass (imf14.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1652395073-779421 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: On Tue, 10 May 2022 15:30:36 +0200 Oleksandr Natalenko wrote: > > If ksm_force is set to 1, force all anonymous and 'qualified' VMAs > > of this mm to be involved in KSM scanning without explicitly calling > > madvise to mark VMA as MADV_MERGEABLE. But It is effective only when > > the klob of /sys/kernel/mm/ksm/run is set as 1. > > > > If ksm_force is set to 0, cancel the feature of ksm_force of this > > process (fallback to the default state) and unmerge those merged pages > > belonging to VMAs which is not madvised as MADV_MERGEABLE of this process, > > but still leave MADV_MERGEABLE areas merged. > > To my best knowledge, last time a forcible KSM was discussed (see threads [1], [2], [3] and probably others) it was concluded that a) procfs was a horrible interface for things like this one; and b) process_madvise() syscall was among the best suggested places to implement this (which would require a more tricky handling from userspace, but still). > > So, what changed since that discussion? > > P.S. For now I do it via dedicated syscall, but I'm not trying to upstream this approach. Why are you patching the kernel with a new syscall rather than using process_madvise()?