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 CC5B5C761A6 for ; Thu, 30 Mar 2023 14:26:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F2F646B0071; Thu, 30 Mar 2023 10:26:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EDF0D6B0072; Thu, 30 Mar 2023 10:26:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA7526B0074; Thu, 30 Mar 2023 10:26:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C9CD76B0071 for ; Thu, 30 Mar 2023 10:26:51 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 7DE51AC80E for ; Thu, 30 Mar 2023 14:26:51 +0000 (UTC) X-FDA: 80625791022.20.D32F92E Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) by imf28.hostedemail.com (Postfix) with ESMTP id 8F542C000B for ; Thu, 30 Mar 2023 14:26:48 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=iyOo8bXd; spf=pass (imf28.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.208.45 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680186409; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QsGthCQYXjIfvDeabffEM/f5wN+q2oR2FxUqxZJndqk=; b=z2a2JI8IuWxG1uPJ9sx9ija5/1NGogUes8aCyRTVPtOXvHdrPxRaFDRYjUkpi/XDRd+fI2 tLvGzAAhGeTjNdp/L48iK/jbYsrBlC5oKjRsvodzYFGzEz8r+gdIuzqVuZ9B7rnllwAw6t YKF6iXpU1p5avdacwQFQECJICSs53ZA= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=iyOo8bXd; spf=pass (imf28.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.208.45 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680186409; a=rsa-sha256; cv=none; b=QXlo0LfDyXEkKR/NtVmX88T/5BKwIW4s0snmwWAHva9Z9TBFlcQpRkjf3ylrET99ovmqVp UX1Dg0U8KhtvaTjvS/9L8FdgWMMNQlPtvYkfW5Y7Am9DmIr+SrkRHr/UGVBaLCgpqKEWxc lklj7N9vhCR4STSMHxfsE9uyOFUCU/Q= Received: by mail-ed1-f45.google.com with SMTP id b20so77267036edd.1 for ; Thu, 30 Mar 2023 07:26:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; t=1680186407; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=QsGthCQYXjIfvDeabffEM/f5wN+q2oR2FxUqxZJndqk=; b=iyOo8bXd0VqmhAwD1Y2Tt4T1CILYurngj/BRCv0x3DA4rtsKkvX4E9Cxen1kc09QXo cPVQ7BZptrXsVbQoiOx/F+yvsn2a/42ksKi2dcrGdZDPb5n1VKRPwY1UPB/WoY7CbS1d 4mu3l0VqjEe+29ETyOzZnRCQqQt4CRpZQ4WrCfnWdmZbq1UxlHQTNVkXTZTQs/5IXWJ3 VKON+7XXVGQ9OxQqKDKUHU12NENFAMoBNnVeXvDjWdzPqA1RVeRHFUa8wPb5wFcDJULw DURUhpXnzSO8DXRgbJt+/IcwrhVWKd1UIg/acHvx6BqJNVGViszbLnFT+foHGrID8BmR aKAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680186407; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QsGthCQYXjIfvDeabffEM/f5wN+q2oR2FxUqxZJndqk=; b=R4b6bb1bOskmL3m4u68XNB/CRdfx2gS4WBjzkveQ+oU/6RTGLbFp53LhjY8mF62XSW z915drLekzqlzWouvC/ji8lKp0mBYP/WiokuzOvNYJ7SQYXKhObKh1ED6mb7BHcukLi+ DDlwOx4Dy/CmGVQNxQfXTlmj+sKFSeGUzuGJx9EPgXmnhB8FcnmEtpBJGb8vhE1MfxmX ahiVyT0ErnioY0qAjhb+xvxvN32/MRbk0wz6Oee+lgRyDDWBBYh2GW1unNr7+R0AsR1c hMr1OPLioK2A6+UjlvTrZivV40deUv1tSYj3QN2DaJwjxhPzeQgwpCMJJFSsU5xiGA4u NB5A== X-Gm-Message-State: AAQBX9cTQifyTAESrPQRdQJ3nmbOrN5WyGIEq4KKQTDZt5Tr5e9tE70b jysIs21AXsX5z2gIWe+m5QZQFg== X-Google-Smtp-Source: AKy350ZM1ex4+4TOh6/zBJT91Cxp19RJGKoOvW9DYZ7UIRVR22IZ6XlXoiGc92rtR1h0709uE2dxJw== X-Received: by 2002:aa7:c141:0:b0:4fa:ada1:796d with SMTP id r1-20020aa7c141000000b004faada1796dmr22183584edp.10.1680186406820; Thu, 30 Mar 2023 07:26:46 -0700 (PDT) Received: from localhost ([2a02:8070:6387:ab20:5139:4abd:1194:8f0e]) by smtp.gmail.com with ESMTPSA id a13-20020a509e8d000000b00501d73cfc86sm13253433edf.9.2023.03.30.07.26.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 07:26:46 -0700 (PDT) Date: Thu, 30 Mar 2023 10:26:45 -0400 From: Johannes Weiner To: David Hildenbrand Cc: Andrew Morton , Stefan Roesch , kernel-team@fb.com, linux-mm@kvack.org, riel@surriel.com, mhocko@suse.com, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, Hugh Dickins Subject: Re: [PATCH v4 0/3] mm: process/cgroup ksm support Message-ID: References: <20230310182851.2579138-1-shr@devkernel.io> <20230328160914.5b6b66e4a5ad39e41fd63710@linux-foundation.org> <37dcd52a-2e32-c01d-b805-45d862721fbc@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <37dcd52a-2e32-c01d-b805-45d862721fbc@redhat.com> X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: pq4kth9ceiu5strwsz5ihucrrq19fhtm X-Rspamd-Queue-Id: 8F542C000B X-HE-Tag: 1680186408-405893 X-HE-Meta: U2FsdGVkX1/bbSDK+uT49aeFGpMJm0JKdhNSw/DbtF+Q0Lw3XpN3Z1YaBfoh0wFgn082fqnN9d9blEi/zeAonBHYk7UM4SsDW6GEXClylUjghYC2chIqjvCMeB28SCDKDo4cS/E4HSZppTxvuGBkMJcTOsv11WBD0UZjIKgOlCOxTBJgoH0EkgWCP8DS3NLdAxLBh/2iCwCSqsKZzmzfrK9oqbkCXZshIAIhBXt5h/12ee1Y6eHgwUEbTbR1hn1BS5figmA5tx5gfd6NIIdI2AeV55tGKJAhbiC2MZ+aHN7wnP7DmK8dOKgGvfBtQt1g8Bxgr1H+Ci4eTVXr542YM+bg3PqVebkY2EixpNLmSjcKQX8660751tVqBzPXEvSTYQ0tcQ8kx8AHk1mJs7NCl/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.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Mar 30, 2023 at 06:55:31AM +0200, David Hildenbrand wrote: > On 29.03.23 01:09, Andrew Morton wrote: > > On Fri, 10 Mar 2023 10:28:48 -0800 Stefan Roesch wrote: > > > > > So far KSM can only be enabled by calling madvise for memory regions. To > > > be able to use KSM for more workloads, KSM needs to have the ability to be > > > enabled / disabled at the process / cgroup level. > > > > Review on this series has been a bit thin. Are we OK with moving this > > into mm-stable for the next merge window? > > I still want to review (traveling this week), but I also don't want to block > this forever. > > I think I didn't get a reply from Stefan to my question [1] yet (only some > comments from Johannes). I would still be interested in the variance of > pages we end up de-duplicating for processes. > > The 20% statement in the cover letter is rather useless and possibly > misleading if no details about the actual workload are shared. The workload is instagram. It forks off Django runtimes on-demand until it saturates whatever hardware it's running on. This benefits from merging common heap/stack state between instances. Since that runtime is quite large, the 20% number is not surprising, and matches our expectations of duplicative memory between instances. Obviously we could spend months analysing which exact allocations are identical, and then more months or years reworking the architecture to deduplicate them by hand and in userspace. But this isn't practical, and KSM is specifically for cases where this isn't practical. Based on your request in the previous thread, we investigated whether the boost was coming from the unintended side effects of KSM splitting THPs. This wasn't the case. If you have other theories on how the results could be bogus, we'd be happy to investigate those as well. But you have to let us know what you're looking for. Beyond that, I don't think we need to prove from scratch that KSM can be a worthwhile optimization. It's been established that it can be. This series is about enabling it in scenarios where madvise() isn't practical, that's it, and it's yielding the expected results.