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 D6615C433FE for ; Thu, 19 May 2022 08:02:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6F08C6B0072; Thu, 19 May 2022 04:02:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 678406B0073; Thu, 19 May 2022 04:02:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 566FB6B0074; Thu, 19 May 2022 04:02:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 482F66B0072 for ; Thu, 19 May 2022 04:02:14 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1783020B47 for ; Thu, 19 May 2022 08:02:14 +0000 (UTC) X-FDA: 79481749788.02.5FDE295 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by imf01.hostedemail.com (Postfix) with ESMTP id 522B4400DA for ; Thu, 19 May 2022 08:02:13 +0000 (UTC) Received: by mail-pj1-f43.google.com with SMTP id nr2-20020a17090b240200b001df2b1bfc40so8062086pjb.5 for ; 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=xpH3Ykip5ZdzjxY+v6uCIGwJIGKcBpGHx8QLKxpSsHQzPdM6zQyRUByPTuci2wk/P9 GnGRR5P8iLKCHp5pfyKjdbfrUD01TW3AKoRp4sngGXSrSC2UORA7mgxKw9d0dqf8vqqy vTxwH+me+N9UuRUtcP5nOvTxIXLWQb35OOZLkkF4Lf0vdcL8rNxy/cfeITFDlY7WS3Jj BeCOwIDXcvEWee8i7VW9T+uloxqeNoCHEZGAKIOwtMC0RA/afD3fK6LBaYE1RPjLOqzG Grv0FAr/KBhSI4IlNRr1zBDq+MHocsnruYVwZ2z8QJfz2O5KzpUNopa+9oTRcF4AdSb8 PFjA== X-Gm-Message-State: AOAM532C4tUNCddjczSn2EcRwcgyQZLUFjBHjIGQkt46mjsxC1cLIzH5 a84MOXpDmEqIypJ+LOs+XT0= 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: X-Stat-Signature: e3mp1a9p61astt5tfd399ckufwn14hs4 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 522B4400DA Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=lUpcKplB; spf=pass (imf01.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.216.43 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-HE-Tag: 1652947333-158749 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: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