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 B58D2C433EF for ; Fri, 18 Mar 2022 08:24:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5330C8D0003; Fri, 18 Mar 2022 04:24:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E1428D0001; Fri, 18 Mar 2022 04:24:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A94D8D0003; Fri, 18 Mar 2022 04:24:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 2D10D8D0001 for ; Fri, 18 Mar 2022 04:24:50 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0370588C for ; Fri, 18 Mar 2022 08:24:49 +0000 (UTC) X-FDA: 79256821140.01.FBD5205 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 62D428000F for ; Fri, 18 Mar 2022 08:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647591889; 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=vWQLy5IVfUZr3c04Id1YtbqZ9FtSqY8WSD+6zPZmxk8=; b=Oh0p/TZDnOVhFieBh1M+k+FA4pZOUv1qenGG8Sdf9fzfMjNSXDwM2mOWJBGkK8mVmNZ3z6 S0HAB3Q2CYqG38navJEF/s2YZYBgyHGPSGfZy6ydI8gc5TzajtNO6Jnebt4LqvXPMq5Whd xpH08hBTx1IYNK3ajNmPSOlkAjfwMdM= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-68-mdM_xpDNP9yO_bPJO7G5Gw-1; Fri, 18 Mar 2022 04:24:47 -0400 X-MC-Unique: mdM_xpDNP9yO_bPJO7G5Gw-1 Received: by mail-wm1-f71.google.com with SMTP id q6-20020a1cf306000000b0038c5726365aso2962387wmq.3 for ; Fri, 18 Mar 2022 01:24:47 -0700 (PDT) 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:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=vWQLy5IVfUZr3c04Id1YtbqZ9FtSqY8WSD+6zPZmxk8=; b=xZhByJ9wmbKzkxORGzMfxd4iayrUS+M9V6If8nfE+bOCRVOWn3eDmlu8mdfxInIqEZ P0L9MSrBrclCz24q4KDcpe7FZDoAUcr69843CjKv4krVtROUbCsVWb5C1S2UDBk/mAxq VNw9YZcym9cRGXK0fqyPteQBs/TKnqbl9Gs5ZNOol55aUDiuHQu0FUi7EVQ6mDk3cQrc faSeUxiUo3MSjK8Bwpm+EgIHO9gxZqrw5wuFkL3U1p39UYkdJSfQWAknJT/NvSIFNdG0 fiXeQi3CxeLkDKEtnIUVp4vO7s9oUl3dSVgZ/IVcujEjLDpuAR7KifQjxpzQxLQxvdUq jNWQ== X-Gm-Message-State: AOAM530syC7hHneijJLMJhU8dTyRxXnYhBv2mSskVCfN4TdjH8qbIdRc YthXp9TArPws9+eimedToXOt7p/7d00bJzpkFgp2PNDC6nzERBxSkFW3kHkAbePZ+ZRVOjwtoJn KCHtgem3TBDY= X-Received: by 2002:adf:cd87:0:b0:203:71f9:c333 with SMTP id q7-20020adfcd87000000b0020371f9c333mr7110954wrj.637.1647591886181; Fri, 18 Mar 2022 01:24:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlAz62Pxp0wcCrGpcp/tyulFJ+36qaAxKyjHqN6oK+VcYWMJUFZFhI9BMDgDpasBAND2YfvA== X-Received: by 2002:adf:cd87:0:b0:203:71f9:c333 with SMTP id q7-20020adfcd87000000b0020371f9c333mr7110940wrj.637.1647591885941; Fri, 18 Mar 2022 01:24:45 -0700 (PDT) Received: from ?IPV6:2003:d8:2f24:9200:124e:f0bf:6f8c:cbd8? (p200300d82f249200124ef0bf6f8ccbd8.dip0.t-ipconnect.de. [2003:d8:2f24:9200:124e:f0bf:6f8c:cbd8]) by smtp.gmail.com with ESMTPSA id r186-20020a1c2bc3000000b0037bdd94a4e5sm6129710wmr.39.2022.03.18.01.24.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Mar 2022 01:24:45 -0700 (PDT) Message-ID: <2bb1c357-5335-9d96-d862-bd51c1014193@redhat.com> Date: Fri, 18 Mar 2022 09:24:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH] delayacct: track delays from ksm cow To: CGEL Cc: bsingharora@gmail.com, akpm@linux-foundation.org, yang.yang29@zte.com.cn, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20220316133420.2131707-1-yang.yang29@zte.com.cn> <412dc01c-8829-eac2-52c7-3f704dbb5a98@redhat.com> <6232970f.1c69fb81.4e365.c9f2@mx.google.com> <4e76476b-1da0-09c5-7dc4-0b2db796a549@redhat.com> <62330402.1c69fb81.d2ba6.0538@mx.google.com> <987bd014-c5ab-52cb-627e-2085560cb327@redhat.com> <6233e342.1c69fb81.692f.6286@mx.google.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <6233e342.1c69fb81.692f.6286@mx.google.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 62D428000F X-Rspam-User: Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Oh0p/TZD"; spf=none (imf02.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Stat-Signature: mum3oirs1mzwyorqnqa9hwych8bcmn8n X-Rspamd-Server: rspam07 X-HE-Tag: 1647591889-179190 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 18.03.22 02:41, CGEL wrote: > On Thu, Mar 17, 2022 at 11:05:22AM +0100, David Hildenbrand wrote: >> On 17.03.22 10:48, CGEL wrote: >>> On Thu, Mar 17, 2022 at 09:17:13AM +0100, David Hildenbrand wrote: >>>> On 17.03.22 03:03, CGEL wrote: >>>>> On Wed, Mar 16, 2022 at 03:56:23PM +0100, David Hildenbrand wrote: >>>>>> On 16.03.22 14:34, cgel.zte@gmail.com wrote: >>>>>>> From: Yang Yang >>>>>>> >>>>>>> Delay accounting does not track the delay of ksm cow. When tasks >>>>>>> have many ksm pages, it may spend a amount of time waiting for ksm >>>>>>> cow. >>>>>>> >>>>>>> To get the impact of tasks in ksm cow, measure the delay when ksm >>>>>>> cow happens. This could help users to decide whether to user ksm >>>>>>> or not. >>>>>>> >>>>>>> Also update tools/accounting/getdelays.c: >>>>>>> >>>>>>> / # ./getdelays -dl -p 231 >>>>>>> print delayacct stats ON >>>>>>> listen forever >>>>>>> PID 231 >>>>>>> >>>>>>> CPU count real total virtual total delay total delay average >>>>>>> 6247 1859000000 2154070021 1674255063 0.268ms >>>>>>> IO count delay total delay average >>>>>>> 0 0 0ms >>>>>>> SWAP count delay total delay average >>>>>>> 0 0 0ms >>>>>>> RECLAIM count delay total delay average >>>>>>> 0 0 0ms >>>>>>> THRASHING count delay total delay average >>>>>>> 0 0 0ms >>>>>>> KSM count delay total delay average >>>>>>> 3635 271567604 0ms >>>>>>> >>>>>> >>>>>> TBH I'm not sure how particularly helpful this is and if we want this. >>>>>> >>>>> Thanks for replying. >>>>> >>>>> Users may use ksm by calling madvise(, , MADV_MERGEABLE) when they want >>>>> save memory, it's a tradeoff by suffering delay on ksm cow. Users can >>>>> get to know how much memory ksm saved by reading >>>>> /sys/kernel/mm/ksm/pages_sharing, but they don't know what the costs of >>>>> ksm cow delay, and this is important of some delay sensitive tasks. If >>>>> users know both saved memory and ksm cow delay, they could better use >>>>> madvise(, , MADV_MERGEABLE). >>>> >>>> But that happens after the effects, no? >>>> >>>> IOW a user already called madvise(, , MADV_MERGEABLE) and then gets the >>>> results. >>>> >>> Image user are developing or porting their applications on experiment >>> machine, they could takes those benchmark as feedback to adjust whether >>> to use madvise(, , MADV_MERGEABLE) or it's range. >> >> And why can't they run it with and without and observe performance using >> existing metrics (or even application-specific metrics?)? >> >> > I think the reason why we need this patch, is just like why we need > swap,reclaim,thrashing getdelay information. When system is complex, > it's hard to precise tell which kernel activity impact the observe > performance or application-specific metrics, preempt? cgroup throttle? > swap? reclaim? IO? > > So if we could get the factor's precise impact data, when we are tunning > the factor(for this patch it's ksm), it's more efficient. > I'm not convinced that we want to make or write-fault handler more complicated for such a corner case with an unclear, eventual use case. IIRC, whenever using KSM you're already agreeing to eventually pay a performance price, and the price heavily depends on other factors in the system. Simply looking at the number of write-faults might already give an indication what changed with KSM being enabled. Having that said, I'd like to hear other opinions. -- Thanks, David / dhildenb