Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4808687rwe; Tue, 30 Aug 2022 18:04:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR6x3KwxEcQ41gcDIXkJbX6fLUVhvLKhf0x4QSPyTUAVTsPca0GwA6feNwS/hM2GH6ZAUJi7 X-Received: by 2002:a05:6402:4cf:b0:446:42cf:e49d with SMTP id n15-20020a05640204cf00b0044642cfe49dmr22302029edw.41.1661907879734; Tue, 30 Aug 2022 18:04:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661907879; cv=none; d=google.com; s=arc-20160816; b=WHly7SDhFZC0jzmdQ+hV6a+j1r3tsCvIJsXDtgo71WW8dD0Rg5aQTc82t9DCon9P8H 85GjP5aKQlGArIYAoAjfVuLeAt0zSsx6woFqMPms4+fqNjPJvJLJl1L+pLc2ymJH/QPS k/us02XcqyK5jw9LGBTovN+e7yKn6V+q48tgGcc5Bkp0wFrn21Ysf96pnZrh85pcRPdT dHCSDc2IE39roA/3ruojVy/J6g+vUipNGGMgcLxeBKrxSM9A6vcWsX7BfD+B3RqeJUgH f2qVDKT2v9T/8qUQNUyVPi2CpRBuqB9dnE72WtxpDljcgJ5PyFprQ/IW89QYw6SYQbKQ IqPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=+iTrfrGdAA7ULsXsob0NdzAzbv3oUw/OhOXi+PD1zgY=; b=jPIqLuhKUF6SbeQ9AxoguaNUMSaBm2mrDygfEjmn62dbaC67W2C29ZmUHzJmsInVnZ gMvjMIPL7wRhlG7dkzVxlDR7qetWcSV3FBxNcitt15g+8OV5lTKJF1eF+CDHAwqC4ijg cgWZhC3j+evdLtaUCuh8NM1yEqxt6aaqUXeh8Cn/vtlXzIfsJBBXfA/uQc6tTTKH89bk Rf9Mp6pWMy0vjH4GaOQ1O4nZFFvR1voqqDdfwTSTbvWZ0ALqSz5GrT8vISYrYLKAx0gr 5qv09gcoCBlVAOtcxr5HhnfbQoi1V3/FPsXgde6xI9rclH47oJEuCbB9J8UNqySv7ytD IKrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=bPsw9hHl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a05640250ce00b00446c0ce86ddsi5122548edb.424.2022.08.30.18.04.13; Tue, 30 Aug 2022 18:04:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=bPsw9hHl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232334AbiHaAlc (ORCPT + 99 others); Tue, 30 Aug 2022 20:41:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232066AbiHaAlL (ORCPT ); Tue, 30 Aug 2022 20:41:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F25B2B634; Tue, 30 Aug 2022 17:40:05 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id E18B9617AB; Wed, 31 Aug 2022 00:38:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB1AEC433D6; Wed, 31 Aug 2022 00:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1661906317; bh=nblg12V1/C6LuB4b59SMW1k6ImcfN1zX4PRZ4rfiGBg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=bPsw9hHl7o0c4UbkM02pZaor1X50lndnOai+l7iV+sOv7DtduLwkTWgbv4Q86dIQt DKS0nRxxCilBeb9A1VXU/dPs90zY89M32JZr4luA0OuE1S6IrDEWWSsLbT3mfbmcg9 Fp29L1dXQ6B9+Vq7e0kzbRaHKyq6aL/feSELUvF8= Date: Tue, 30 Aug 2022 17:38:36 -0700 From: Andrew Morton To: xu xin Cc: adobriyan@gmail.com, willy@infradead.org, bagasdotme@gmail.com, hughd@google.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, xu xin , Izik Eidus , Alexey Dobriyan Subject: Re: [PATCH v5 0/2] ksm: count allocated rmap_items and update documentation Message-Id: <20220830173836.4e1a2a75c5e9cfb61638722a@linux-foundation.org> In-Reply-To: <20220830143731.299702-1-xu.xin16@zte.com.cn> References: <20220830143731.299702-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-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 30 Aug 2022 14:37:31 +0000 xu xin wrote: > KSM can save memory by merging identical pages, but also can consume > additional memory, because it needs to generate rmap_items to save > each scanned page's brief rmap information. > > To determine how beneficial the ksm-policy (like madvise), they are using > brings, so we add a new interface /proc//ksm_stat for each process > The value "ksm_rmap_items" in it indicates the total allocated ksm > rmap_items of this process. I can see the usefulness and the code change is very simple, so I'll queue it for testing and shall see what other reviewers have to say. It's useful that the per-process file is called "ksm_stat", because we may with to add additional content to it in the future. Because concerns have been expressed (by Alexey) about the proliferation of procfs files causing major memory use when something reads them all. Putting more things in the same procfs files will help avoid this.