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 8B29AC76196 for ; Thu, 6 Apr 2023 13:23:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F01426B0071; Thu, 6 Apr 2023 09:23:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB0E86B0074; Thu, 6 Apr 2023 09:23:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9FD36B007B; Thu, 6 Apr 2023 09:23:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CB9E86B0071 for ; Thu, 6 Apr 2023 09:23:20 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 9B9D6ACB5C for ; Thu, 6 Apr 2023 13:23:20 +0000 (UTC) X-FDA: 80651032560.07.9B65462 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf16.hostedemail.com (Postfix) with ESMTP id E3BA1180026 for ; Thu, 6 Apr 2023 13:23:15 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IJvuZi5A; spf=pass (imf16.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680787396; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=e7Hmzr+9HB3Bn94tWpFODla1b+fc9Td8o9IH5wnZAGQ=; b=p7h3CFtrcOy+DBZBdEhDUSvr1Yn5t8BX3gNnDckXSGl3GGG5ja2LiKWFreJBzrlpI3fpBL eBg9KMbrjQmfDg+UDNWaqbmrGDj2jhxb5Cyip6Zwr9EJLjwSQBjcZ+ebg9rd72LIGLsyP0 YQcjHy/n91rK+g3OmZDxVCKCRKlfPZ0= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IJvuZi5A; spf=pass (imf16.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680787396; a=rsa-sha256; cv=none; b=GT/HgSluAWA3mxaxpyl07dSKlvGit66siyVuUl1aGnuvOHczH4mUUmAxPM4i/XMZ8+Rq1u ESw5x8kC8N9plL6A5gnX+4m9ftlbeDlifHE3WoJ/3604tNY7ak+6U0xPF/AjtT/fpxo9Un WhZEo7bbflU6HHy4buLnsGyRGL3gXRA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680787395; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e7Hmzr+9HB3Bn94tWpFODla1b+fc9Td8o9IH5wnZAGQ=; b=IJvuZi5AGySZtZ3n1D6T3KlRccHp5Bia6smlFHQRFNXtde/WIFEWtu+hlc1xbxNR8/1AdG /lvZokz/UXcnZ5kmIjvgXtFB+i1CU9q1ni0k7tFTzJ+Mheh83jGJMlMm0EDo4q1jSjnUSg 5qNJqCpGiF2X8kR/9lWRUwsHB2lzLfQ= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-mIFhRpPVOv6-psRfi2NeNQ-1; Thu, 06 Apr 2023 09:23:14 -0400 X-MC-Unique: mIFhRpPVOv6-psRfi2NeNQ-1 Received: by mail-wm1-f70.google.com with SMTP id i4-20020a05600c354400b003ef649aa8c7so17047030wmq.6 for ; Thu, 06 Apr 2023 06:23:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680787393; x=1683379393; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=e7Hmzr+9HB3Bn94tWpFODla1b+fc9Td8o9IH5wnZAGQ=; b=7zJ1HZFAcK7fI+Iq7Y0NmMjX/Mb05TVEQG/oELnsFGOCwj4r47J/pcan2bJ5jIVWoU KRB3/zQaOZrKFv0U+XaqC5POhDslLfwFj6T/c1K6FP/Arizv8D7c9zT4t3vWySqDL86S NtYX9SgLqV7UL77QqKp4fdv/zmLNoEmUjDJh7EJzeVNen9pwkXAhjrDaQEJ947LQOjlD H+kgGngfdnF/Gzo+80QAcXnknFwMCrOPq+GSeuLWNYGC0OdLSfUc08LPG9ZoKXjvivQu 39lzWb6q38CDs9L2pCkN+g4RYTZD0iZVlMbWa4ZSX3bqYsZ7RHLFOmZyQt5pkkMt8/Dg dhzA== X-Gm-Message-State: AAQBX9e3KbXiaIorjimgayM4qYDzRbyoqynUzNNOcPfP4UplhusFTACA oJR85ZTtx8jLjW98OYVCbvu/AyNryTiMDoW2KFzOKqOiItgPNdZsqbptU5TVBi+zrSgG0oHNw+5 j+u4C2x0v8oU= X-Received: by 2002:a05:600c:2216:b0:3e2:1dac:b071 with SMTP id z22-20020a05600c221600b003e21dacb071mr4319558wml.13.1680787392952; Thu, 06 Apr 2023 06:23:12 -0700 (PDT) X-Google-Smtp-Source: AKy350YcbkiaS8MTBR4JZ3ECj8Euw4BG/3vHhNsIZuEhi84AOHoHz8xwwrzQdwYxnoyhI8a3PQ+54g== X-Received: by 2002:a05:600c:2216:b0:3e2:1dac:b071 with SMTP id z22-20020a05600c221600b003e21dacb071mr4319547wml.13.1680787392649; Thu, 06 Apr 2023 06:23:12 -0700 (PDT) Received: from ?IPV6:2a09:80c0:192:0:5dac:bf3d:c41:c3e7? ([2a09:80c0:192:0:5dac:bf3d:c41:c3e7]) by smtp.gmail.com with ESMTPSA id t16-20020a05600c451000b003ef66c89af0sm8750890wmo.0.2023.04.06.06.23.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Apr 2023 06:23:12 -0700 (PDT) Message-ID: Date: Thu, 6 Apr 2023 15:23:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v4 2/3] mm: add new KSM process and sysfs knobs To: Stefan Roesch Cc: kernel-team@fb.com, linux-mm@kvack.org, riel@surriel.com, mhocko@suse.com, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, akpm@linux-foundation.org, hannes@cmpxchg.org, Bagas Sanjaya References: <20230310182851.2579138-1-shr@devkernel.io> <20230310182851.2579138-3-shr@devkernel.io> From: David Hildenbrand Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: E3BA1180026 X-Stat-Signature: cqjgckp1x6aswq3gqn3kjey7wemiwbew X-HE-Tag: 1680787395-389641 X-HE-Meta: U2FsdGVkX18+fW4KCxHre54XcJM+h/jQngXTXaOOuTe0LwQomAYqW2a/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XBXWfqNPJyBp9iATUfrUPIAhBcDUY77/gjZGYkcg3T34aTo5RK0rQTd/m3BidEdwXTGXCH/gp6SN7n5uwIbINx34FnXonDOxuZ7VphnPSim2Pwsy2hpiB1x15weTZLHvYHaDKA6J7fYrKwsFK74qgttYxXohqqjUy5qi/3+O+3KxlS7oVBteDGNbF+ffv+SukJQxMLzb8PWubkRaMnfnP2v0xI2xRAWmpwPIJOB6uKv/lVZ3Rhy6xqT4ybiNJZYH9E6M+u0oYmbzQZS+XatzI2vUz8MZGVFaS6q58FCuJ8VMEPOySr8qE2NT/oTxKuahSrsgsURZnwxm0r6atE4zyf8LGpDjZtWZFSAxJlVlyymSP3Rt2UXiypm4ORgJT8quiJPMq8S30v3dOjOMDPCY6Fn6rUwO4SSBNZMTDBDGynFO6tzpnNDQ/91JZ8nXGKnI/aTe81MLr/25lpjmOr4cAUmqZQ8g/q5PA2m9CiQ26cD+r7vtnC3sun7Fs9KDIcjC9illC51bTrfRoEPNlw/rv+rBaDUw2WpiS6A= 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: >> >> Often, when you have to start making a list of things that a patch does, it >> might make sense to split some of the items into separate patches such that you >> can avoid lists and just explain in list-free text how the pieces in the patch >> fit together. >> >> I'd suggest splitting this patch into logical pieces. For example, separating >> the general profit calculation/exposure from the per-mm profit and the per-mm >> ksm type indication. >> > > Originally these were individual patches. If I recall correctly Johannes > Weiner wanted them as one patch. I can certainly split them again. That's why I remember that v1 contained more patches :) Again, just my opinion on patches that require a description in form of a list ... > >>> Link: https://lkml.kernel.org/r/20230224044000.3084046-3-shr@devkernel.io >>> Signed-off-by: Stefan Roesch >>> Reviewed-by: Bagas Sanjaya >>> Cc: David Hildenbrand >>> Cc: Johannes Weiner >>> Cc: Michal Hocko >>> Cc: Rik van Riel >>> Signed-off-by: Andrew Morton >>> --- >> >> >> [...] >> >>> KSM_ATTR_RO(pages_volatile); >>> @@ -3280,6 +3305,21 @@ static ssize_t zero_pages_sharing_show(struct kobject >>> *kobj, >>> } >>> KSM_ATTR_RO(zero_pages_sharing); >>> +static ssize_t general_profit_show(struct kobject *kobj, >>> + struct kobj_attribute *attr, char *buf) >>> +{ >>> + long general_profit; >>> + long all_rmap_items; >>> + >>> + all_rmap_items = ksm_max_page_sharing + ksm_pages_shared + >>> + ksm_pages_unshared + pages_volatile(); >> >> Are you sure you want to count a config knob (ksm_max_page_sharing) into that >> formula? I yet have to digest what this calculation implies, but it does feel >> odd. >> > > This was a mistake. I wanted ksm_pages_sharing instead of > ksm_max_page_sharing. > >> >> Further, maybe just avoid pages_volatile(). Expanding the formula (excluding >> ksm_max_page_sharing for now): >> >> >> all_rmap = ksm_pages_shared + ksm_pages_unshared + pages_volatile(); >> >> -> expand pages_volatile() (ignoring the < 0 case) >> >> all_rmap = ksm_pages_shared + ksm_pages_unshared + ksm_rmap_items - >> ksm_pages_shared - ksm_pages_sharing - ksm_pages_unshared; >> >> -> simplify >> >> all_rmap = ksm_rmap_items + ksm_pages_sharing; >> > I'll simplify it. Cool. -- Thanks, David / dhildenb