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 831BDC27C76 for ; Wed, 25 Jan 2023 11:07:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A69A6B0073; Wed, 25 Jan 2023 06:07:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 156A66B0075; Wed, 25 Jan 2023 06:07:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F39026B0078; Wed, 25 Jan 2023 06:06:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E34536B0073 for ; Wed, 25 Jan 2023 06:06:59 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9614FC0D1B for ; Wed, 25 Jan 2023 11:06:59 +0000 (UTC) X-FDA: 80393044158.29.B2E9BC8 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 0DA328001A for ; Wed, 25 Jan 2023 11:06:56 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Y3rtlgem; spf=pass (imf02.hostedemail.com: domain of leobras@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=leobras@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=1674644817; 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=kGyxR4QjlvV59Dun3XoNVcSY9X+5yxzcZa0pgXIqYKk=; b=QyHw5y1z7uuMKVAwUgdoZKx9OSMZjujZEQSc5jMwnwRuqPLbSLLLNu6kKEEo7HVfeJpnhk U6PrH/7AeCUi6ESvu5wEeuB3Bi7hqgOUR/DQGDhvj1goeoeWIfjtTLczb1Rx8Wo/YFU/Rt kNztuAfZvNUUDxp+n+lpPO3b60FgmVA= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Y3rtlgem; spf=pass (imf02.hostedemail.com: domain of leobras@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=leobras@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674644817; a=rsa-sha256; cv=none; b=lNRXHsnQV/SpBqWOYiLpz4A5V2nHVFds3pSQRjhE6m2H0wDpJ+KYs+hxCwX7Elkdq+eC11 5UkLRr3ZXdLQzXpUj5B2WnGkJy/3gqgxm/cHWdq/PF7m6c9+BTfIraFxBJpMqt83+uMs/h zN8NY4r4E9lKT07C1CDuC4QKfvZOTNw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674644816; 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=kGyxR4QjlvV59Dun3XoNVcSY9X+5yxzcZa0pgXIqYKk=; b=Y3rtlgemdabxksMvm9iceYaW6iIvHSbcAaoZEdvrGL+IaQ1pHLPfXUwW5SQ2l+NSaauZtf l6KhsWj1JaQDftPMyl+aX30d0dYu+2In5hB9M+3rsha3lWf4V3Tms1ehpJEKuzZJp3Z6ds 3gWr0rh06F/kqRx3n9ynGpCi906U+t0= Received: from mail-oa1-f70.google.com (mail-oa1-f70.google.com [209.85.160.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-182-I1SdvMzeNSymRuqaaemvEw-1; Wed, 25 Jan 2023 06:06:53 -0500 X-MC-Unique: I1SdvMzeNSymRuqaaemvEw-1 Received: by mail-oa1-f70.google.com with SMTP id 586e51a60fabf-1633a09c1c2so212125fac.17 for ; Wed, 25 Jan 2023 03:06:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kGyxR4QjlvV59Dun3XoNVcSY9X+5yxzcZa0pgXIqYKk=; b=o6g2EtgVAcrSwHWTG2R+p8bhb5hM/sQUtppY40y7GuZhtavdcKzf7BMGq2IN5AVbOd qlaF4cwJ5wckSecj3qcQfgNkrJXyONqXR9ajkvXr4JpWA9lonDxX3w9bBaqgF1z634x3 zvoCSJRlFzAtYADti2N5pOnjV6E3Dh1+3juREx+8Ku6vGdZh/ALMzA2rNwv9JPx6LULi xuKXpB1qfOql7NzjTgcmZWpW5J+GfQVNPtUtG0giwI6it7vmxEbOjBvEhoF2Y9BRi1Id vda8JIn5Z1oYESokJmopAFHH50j+Nh5a/1/2Taxh4gopa6+5hKtwCb+gRAGgRs7Ejxg+ oInQ== X-Gm-Message-State: AFqh2koo70dkIGay57/E7KL0JxjE2ZrG2sbyi43QolC3BSIAb75agpYW Vz1jizhlo7oLdn6zprvxX6Ff8Ycwl2k+nbwpvpY21XwKX04lUqtGQmAi/MTWnZRrNFouNvqQ7MK vccDzok5ReBE= X-Received: by 2002:a05:6871:54c:b0:15e:d38a:9991 with SMTP id t12-20020a056871054c00b0015ed38a9991mr17058751oal.33.1674644812543; Wed, 25 Jan 2023 03:06:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXteDxAqH1GaOU55z1R+UFAi798mOZdTrbwTOsUY2uvJOL3tH8LlrKWLzh+yPmUG1KRgX8GokQ== X-Received: by 2002:a05:6871:54c:b0:15e:d38a:9991 with SMTP id t12-20020a056871054c00b0015ed38a9991mr17058741oal.33.1674644812295; Wed, 25 Jan 2023 03:06:52 -0800 (PST) Received: from ?IPv6:2804:1b3:a800:14fa:9361:c141:6c70:c877? ([2804:1b3:a800:14fa:9361:c141:6c70:c877]) by smtp.gmail.com with ESMTPSA id pq3-20020a0568709c8300b0011d02a3fa63sm1746840oab.14.2023.01.25.03.06.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 03:06:51 -0800 (PST) Message-ID: <9e61ab53e1419a144f774b95230b789244895424.camel@redhat.com> Subject: Re: [PATCH v2 0/5] Introduce memcg_stock_pcp remote draining From: Leonardo =?ISO-8859-1?Q?Br=E1s?= To: Michal Hocko Cc: Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Marcelo Tosatti , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Wed, 25 Jan 2023 08:06:46 -0300 In-Reply-To: References: <20230125073502.743446-1-leobras@redhat.com> User-Agent: Evolution 3.46.2 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: a4do81gh4dkdongm4sgpbt5g15dpxpuj X-Rspamd-Queue-Id: 0DA328001A X-HE-Tag: 1674644816-487094 X-HE-Meta: U2FsdGVkX18etlA37ttF/xoVlhjoegPWKH7WI4R70YGgCVmVcvwa4iW9LOaTVAlZNhUNKq5xXIVbirqbJMQiaBt/IHEiQcWtTUfJzA0yxxki+DMBYVDknVGJM9ZLLpMR+fC00TgP6EmNSTdHaGr8W2Te8Hrc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vyVEAa0YATa3y0lyVODH88pV4CbAJV8r50vnQeWCDsCoCvteEMocKNGijWpe6e7GietXBAClAhgceB9Lra81zo225pFHLfVP4AT4qvc5pEgEVjdKQ9cT9M4hCauu5twZKhbpC1Ax7gJ/v1fDl9AIZTMGVgBsdoMkmQCe5q/i3aSexiPxZK/cgiWbPlqg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.004104, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, 2023-01-25 at 09:33 +0100, Michal Hocko wrote: > On Wed 25-01-23 04:34:57, Leonardo Bras wrote: > > Disclaimer: > > a - The cover letter got bigger than expected, so I had to split it in > > sections to better organize myself. I am not very confortable with = it. > > b - Performance numbers below did not include patch 5/5 (Remove flags > > from memcg_stock_pcp), which could further improve performance for > > drain_all_stock(), but I could only notice the optimization at the > > last minute. > >=20 > >=20 > > 0 - Motivation: > > On current codebase, when drain_all_stock() is ran, it will schedule a > > drain_local_stock() for each cpu that has a percpu stock associated wit= h a > > descendant of a given root_memcg. > >=20 > > This happens even on 'isolated cpus', a feature commonly used on worklo= ads that > > are sensitive to interruption and context switching such as vRAN and In= dustrial > > Control Systems. > >=20 > > Since this scheduling behavior is a problem to those workloads, the pro= posal is > > to replace the current local_lock + schedule_work_on() solution with a = per-cpu > > spinlock. >=20 > If IIRC we have also discussed that isolated CPUs can simply opt out > from the pcp caching and therefore the problem would be avoided > altogether without changes to the locking scheme. I do not see anything > regarding that in this submission. Could you elaborate why you have > abandoned this option? Hello Michal, I understand pcp caching is a nice to have. So while I kept the idea of disabling pcp caching in mind as an option, I f= irst tried to understand what kind of impacts we would be seeing when trying to change the locking scheme. After I raised the data in the cover letter, I found that the performance i= mpact appears not be that big. So in order to try keeping the pcp cache on isolat= ed cpus active, I decided to focus effort on the locking scheme change. I mean, my rationale is: if is there a non-expensive way of keeping the fea= ture, why should we abandon it? Best regards, Leo