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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB5C5C433F5 for ; Tue, 24 May 2022 08:52:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233394AbiEXIwJ (ORCPT ); Tue, 24 May 2022 04:52:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233279AbiEXIwG (ORCPT ); Tue, 24 May 2022 04:52:06 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6E5067D21 for ; Tue, 24 May 2022 01:52:05 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id c14so15906580pfn.2 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=WBXd5q0zP63JgiuIrsgV6wy40BMNOy+GJ7gEExAg8pz4NR3otGibZGYkybS6Jhaplo 5nenlMpQFUZX8bM3MSOjSq34UvNoGG8ejGT2TTjHIabl2YVdLSGvGzpLXGbBtc4d2UdY Y4L1begdxgsil3r5xrz/NGrcxeulgBhqiWRNJtGkv8oAWGz2ISX/vUSzHdRbNkL+n9vp KHSpxWgTLSYcZCsYxWMxF97ufwJXdumxcfN3zE5jMO9MSKVS0+2fodYT5ixLwyVBh4qO 7og6SX7CxSYyS/c1imnpHNkY6O8GYpzkzsQYrBfcVEdnlWceq3Oxi5Ab9EMdJRtJVKke 2Ibw== X-Gm-Message-State: AOAM533mQYQqetMlQquHp20fct9ZaLefxPdO2vuTYV1nBm0fh+ZWRk5C s/drwFHf8yANkPH8gRUD0PQ= 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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