From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC63EC433F5 for ; Sat, 7 May 2022 17:59:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E79FB6B0071; Sat, 7 May 2022 13:59:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E2AFC6B0073; Sat, 7 May 2022 13:59:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA27F6B0074; Sat, 7 May 2022 13:59:31 -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 B72D36B0071 for ; Sat, 7 May 2022 13:59:31 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8B0232EDE0 for ; Sat, 7 May 2022 17:59:31 +0000 (UTC) X-FDA: 79439709342.02.B6FF863 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf14.hostedemail.com (Postfix) with ESMTP id 2D0C5100067 for ; Sat, 7 May 2022 17:59:29 +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 ams.source.kernel.org (Postfix) with ESMTPS id 078EEB80B59; Sat, 7 May 2022 17:59:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 487CDC385A5; Sat, 7 May 2022 17:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1651946367; bh=lXqB3A0Ad6dE9qPBilXIn9VTJGcwZvnO4dUBZTdEwzg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=sDLtH8ryLVHB6nT6SoVTpwvMsKXjWCzTHhDgA2pMAyYiqBjYXVVQC4jAQv21uXYbK J6eXrC00K8tA3TrBE443Vx2GjLPqE/7wX6hV3j9pWv4AK0/ceC0fEw0WWxxDJYf/Ir ehBDbZHpvvcpAk1CQ9uR5ZhB9FkCELD0/0KzWm1g= Date: Sat, 7 May 2022 10:59:26 -0700 From: Andrew Morton To: cgel.zte@gmail.com Cc: keescook@chromium.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, xu xin , Yang Yang , Ran Xiaokai , wangyong , Yunkai Zhang Subject: Re: [PATCH v3] mm/ksm: introduce ksm_force for each process Message-Id: <20220507105926.d4423601230f698b0f5228d1@linux-foundation.org> In-Reply-To: <20220507054702.687958-1-xu.xin16@zte.com.cn> References: <20220507054702.687958-1-xu.xin16@zte.com.cn> 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-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 2D0C5100067 Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=sDLtH8ry; spf=pass (imf14.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspam-User: X-Stat-Signature: 6h4aur8mmgfzpz6epiyatx9pohahd7o8 X-HE-Tag: 1651946369-219449 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 Sat, 7 May 2022 05:47:02 +0000 cgel.zte@gmail.com wrote: > To use KSM, we must explicitly call madvise() in application code, > which means installed apps on OS needs to be uninstall and source > code needs to be modified. It is inconvenient. > > In order to change this situation, We add a new proc 'ksm_force' > under /proc// to support turning on/off KSM scanning of a > process's mm dynamically. > > If ksm_force is set as 1, force all anonymous and 'qualified' vma > of this mm to be involved in KSM scanning without explicitly > calling madvise to make vma MADV_MERGEABLE. But It is effctive only > when the klob of '/sys/kernel/mm/ksm/run' is set as 1. > > If ksm_enale is set as 0, cancel the feature of ksm_force of this > process and unmerge those merged pages which is not madvised as > MERGEABLE of this process, but leave MERGEABLE areas merged. > There are quite a lot of typos here. Please proof-read it. > fs/proc/base.c | 99 ++++++++++++++++++++++++++++++++++++++++ > include/linux/mm_types.h | 9 ++++ > mm/ksm.c | 32 ++++++++++++- And please update the appropriate places under Documentation/ - all user-facing interfaces should be well documented.