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 C4229C433EF for ; Thu, 19 May 2022 08:02:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235090AbiESICn (ORCPT ); Thu, 19 May 2022 04:02:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235097AbiESICO (ORCPT ); Thu, 19 May 2022 04:02:14 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BF3E5711E; Thu, 19 May 2022 01:02:13 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id o13-20020a17090a9f8d00b001df3fc52ea7so8072720pjp.3; Thu, 19 May 2022 01:02:13 -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=3yJKai/GSI12GvKYcBy79Bm3Kne+C3Y1/FfwBn6InA0=; b=lUpcKplBNBAsseV+w7F6nN0KD4nlJAUl1RQRdallDlQrwngsZEeCeHZUYTSXjyTFUc YsXEim9cgXxGDxa0sfNmyOl6LirJYsN+OBlKWD6WzA6LTDv3az8m9fS6YOlDMOQe9eCd iapq+erXJJ43Zne4GbEzqkSI+JpEma/kRtG2LwAoeUZMhHAN19au8KnGEGNAE8VPXAdh qzxyJ/0Z8sTZ6iHknhLW8M4Bl4kNHsWbTJKQxKXSXO/A11ypMcBBHb3Jee4b1+9nyODh MJImMF/s8iTiwpt0I5GW7smg8DKEcLXUH+eo9noNTC2FiTEiPvd8F254ecIeMd3+rSGX JDWQ== 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=3yJKai/GSI12GvKYcBy79Bm3Kne+C3Y1/FfwBn6InA0=; b=cpeDE/QRfh5MNEF7JxHdY7HvIk/cCwkRZp4w8Yoc6Xib7IXjY46XlxQdAg29jF9nmB fKmGmhrkes2Z+fMvIGQFNccK6bX39CJPCO55sxkwrHKaVzSLTi278TtZNkwB7FhiGh+Z W4JC46pTev3/81g2CYDo+WCyQqQTjNfvJO/tbdirZD+1FvAO9+XrTvxh1VWr2XHXj/b2 wy8QAMwl4C8eJjrrNbjU6E9heGOnEXyxLUno5PNB4nS8oiX/Wy5hoc/l1kIq5xwtSDNb NM5ZBvKk8QwZ3IGGQnPThhesN3QFHTXItFAFnqsjoHuRzdkm5NEvAbe8YKn2BS+KVkYE aZeA== X-Gm-Message-State: AOAM532tgKLz/mIFjcouSeq32ORZ2ATQIIRA4A5WgblB61RXtbboWqP2 eG2Y8cThkpCYPmbCF29vnX4FHg2D+5g= X-Google-Smtp-Source: ABdhPJzsw+rFt64D5VXAScc5tgZBDAVE6tCcdwhF942qCujUmJu932Ah37KW2UkQb32431i6ejxGSA== X-Received: by 2002:a17:90b:1a8b:b0:1dc:e565:3238 with SMTP id ng11-20020a17090b1a8b00b001dce5653238mr3900587pjb.64.1652947332557; Thu, 19 May 2022 01:02:12 -0700 (PDT) Received: from localhost ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id d4-20020a170903230400b00161955fe0d5sm3358894plh.274.2022.05.19.01.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 May 2022 01:02:11 -0700 (PDT) Message-ID: <6285f983.1c69fb81.b0a8b.837f@mx.google.com> X-Google-Original-Message-ID: <20220519080210.GA1736367@cgel.zte@gmail.com> Date: Thu, 19 May 2022 08:02:10 +0000 From: CGEL To: Michal Hocko Cc: 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 , Hugh Dickins , linux-api@vger.kernel.org Subject: Re: [PATCH] mm/ksm: introduce ksm_enabled for each process References: <20220517092701.1662641-1-xu.xin16@zte.com.cn> <62845e2b.1c69fb81.cbf4a.1200@mx.google.com> <6285e264.1c69fb81.3f416.71a8@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:35:30AM +0200, Michal Hocko wrote: > On Thu 19-05-22 06:23:30, CGEL wrote: > > On Wed, May 18, 2022 at 02:12:26PM +0200, Michal Hocko wrote: > > > On Wed 18-05-22 02:47:06, CGEL wrote: > > > > On Tue, May 17, 2022 at 04:04:38PM +0200, Michal Hocko wrote: > > > > > [CCing Hugh and linux-api] > > > > > > > > > > On Tue 17-05-22 09:27:01, cgel.zte@gmail.com wrote: > > > > > per mm but the actual implementation currently relies on the per-vma > > > > > flags. That means that one can explicitly disallow merging by madvise > > > > > for a range. Is it wise to override that by a per-process knob? I mean > > > > > there might be a very good reason why a particular memory ranges should > > > > > never be merged but a per-process knob could easily ignore that hint > > > > > from the application. Or am I just confuse? > > > > For now, there is no any hints for letting KSM never merge some memory > > > > ranges. > > > > > > I am not sure I understand. Could you be more specific? > > > > Not like THP, KSM doesn't have anything like VM_NOHUGEPAGE, so apps > > cann't explicitly disallow merging by madvise. If it is really necessary for > > a particular meory ranges of a process to be never merged, we have to submit > > one more patch to achieve that. > > What about MADV_UNMERGEABLE? MADV_UNMERGEABLE and MADV_MERGEABLE usually appear in pairs, MADV_UNMERGEABLE cannot appear alone. I mean MADV_UNMERGEABLE is used to unmerges whatever it merged in the specifed range, not to disallow merging. > -- > Michal Hocko > SUSE Labs