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 E4A22C433F5 for ; Tue, 24 May 2022 08:52:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 236F98D0005; Tue, 24 May 2022 04:52:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1BBC58D0002; Tue, 24 May 2022 04:52:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 082998D0005; Tue, 24 May 2022 04:52:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E81558D0002 for ; Tue, 24 May 2022 04:52:06 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B8FD421522 for ; Tue, 24 May 2022 08:52:06 +0000 (UTC) X-FDA: 79500019452.03.520451E Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by imf27.hostedemail.com (Postfix) with ESMTP id 08D394002C for ; Tue, 24 May 2022 08:52:02 +0000 (UTC) Received: by mail-pg1-f170.google.com with SMTP id t28so8195254pga.6 for ; Tue, 24 May 2022 01:52:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:from:to:cc:subject:references:mime-version :content-disposition:in-reply-to; bh=y5mOl2Uo5pCwJnv90x/yHkDj4UN/bNx3LCnduTlcWjo=; b=i4zg+Y7MIIF4uJ9R1w/Eo3gDfPpT0F1CXJcbTeIfJRWe+Dl9WvvD+GxiE0OGSqNYkp r1//YqBVgQ1OGfAcR+HuN2rIT3bLetHJCS9X3AFMEtvE0Jco2ypCyj5AW4zhXEsAziYK EEsAUu1Q1QwkAakCl//L0bAUpAHj5EucsZbPm+n7He+dOo1R4mZrPO4zARvSmGXVDMKL 3hzchPtS54AlbzOJPKZjJyr7iUPsuxp1ctJVqpekTWhhSfdzZeBuidRLXhwOvHWyX/tl 9nasJTdm+W/h7b6gWvBfMepGYm+hJdEtb1lR8B6NYUTZyyrmhfNyfAVDeQ5LCAjQLCvW G3ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:from:to:cc:subject:references :mime-version:content-disposition:in-reply-to; bh=y5mOl2Uo5pCwJnv90x/yHkDj4UN/bNx3LCnduTlcWjo=; b=xiXt2HnGCBlIVY5GOyYdaLCk2S8L4P98CEhYHomakHD4Olqq7Z+cYqKV+fPCDFwYRB gDtYzvEOwfFr6xmMzt68IduGHz96Rl30yPCk47O2Ia5MbNe3JZBOO6e6aaHbrVYmoirF R2xZUZNWqnNvfJgUOvMKyENzJsl/77nPSFrahJTHI0gv09aW/cJHBr5mABICedOLDqCA HhIRR0Qumf5GzB3k4/fp8xMTgrJ07GNJ0i9l9t43I5U8IabDbpHMTtEQaY4A6ZsCJlxA 26bv7dz75+BOVIgFUlkGJLkvJpQCjNawDtRoe1NAoyUGDR1YWqV+LSbQybayjCsSY/kO g6Xw== X-Gm-Message-State: AOAM533I0BKZDVDs4MDnADcrziiEgcSE23X/MP6gUfJGECQMJ5wiUmUq U44aPQEbEgCWBg16KUOhiYo= X-Google-Smtp-Source: ABdhPJy/6FsFaURgzvPIkmOwFayEsPRqCnbqFBf9gzfqCLnY+rTy2QpBUj7FydyL2tDndNV7vJLz2w== X-Received: by 2002:a65:61b0:0:b0:3f6:5569:94e4 with SMTP id i16-20020a6561b0000000b003f6556994e4mr20902783pgv.430.1653382325044; Tue, 24 May 2022 01:52:05 -0700 (PDT) Received: from localhost ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id rv9-20020a17090b2c0900b001d97f7fca06sm1161451pjb.24.2022.05.24.01.52.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 01:52:04 -0700 (PDT) Message-ID: <628c9cb4.1c69fb81.aec05.30a1@mx.google.com> X-Google-Original-Message-ID: <20220524085202.GA18754@cgel.zte@gmail.com> Date: Tue, 24 May 2022 08:52:02 +0000 From: CGEL To: Michal Hocko Cc: Balbir Singh , akpm@linux-foundation.org, ammarfaizi2@gnuweeb.org, oleksandr@natalenko.name, willy@infradead.org, linux-mm@kvack.org, corbet@lwn.net, linux-kernel@vger.kernel.org, xu xin , Yang Yang , Ran Xiaokai , wangyong , Yunkai Zhang , Jiang Xuexin Subject: Re: [PATCH] mm/ksm: introduce ksm_enabled for each processg References: <20220517092701.1662641-1-xu.xin16@zte.com.cn> <6284a2ef.1c69fb81.e53cd.32b2@mx.google.com> <6285e519.1c69fb81.4f3fe.8057@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 08D394002C X-Stat-Signature: gwijpd6sb3wpjpeakztk3qapya5xkp17 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=i4zg+Y7M; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.215.170 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com X-Rspam-User: X-HE-Tag: 1653382322-828686 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 Thu, May 19, 2022 at 09:39:57AM +0200, Michal Hocko wrote: > On Thu 19-05-22 06:35:03, CGEL wrote: > > On Wed, May 18, 2022 at 02:14:28PM +0200, Michal Hocko wrote: > > > On Wed 18-05-22 07:40:30, CGEL wrote: > > > [...] > > > > 2. process_madvise is still a kind of madvise. processs_madvise from > > > > another process overrides the intention of origin app code ifself that > > > > also calls madvise, which is unrecoverable. For example, if a process "A" > > > > which madvises just one part of VMAs (not all) as MERGEABLE run on the OS > > > > already, meanwhile, if another process which doesn't know the information > > > > of "A" 's MERGEABLE areas, then call process_madvise to advise all VMAs of > > > > "A" as MERGEABLE, the original MERGEABLE information of "A" calling madivse > > > > is erasured permanently. > > > > > > I do not really follow. How is this any different from an external > > > process modifying the process wide policy via the proc or any other > > > interface? > > > > In this patch, you can see that we didn't modify the flag of any VMA of > > the target process, which is different from process_madvise. So it is > > easy to keep the original MERGEABLE information of the target process > > when we turn back to the default state from the state "always". > > This means that /proc//smaps doesn't show the real state, right? Maybe we can add extra information of KSM forcible state in /proc//smaps like THPeligible. Really, Michal, I think it again, 'process_ madvise' is really not good. In addition to some shortcomings I said before, If new vmas of the target process are created after the external process calls process_madvise(), then we have to call `process_madvise()` on them again, over and over again, regularly, just like Oleksandr said [1]. [1]: https://lore.kernel.org/lkml/1817008.tdWV9SEqCh@natalenko.name/ > > -- > Michal Hocko > SUSE Labs