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 0F211C38142 for ; Fri, 27 Jan 2023 07:35:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 60BE58E0001; Fri, 27 Jan 2023 02:35:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5BAEA6B0072; Fri, 27 Jan 2023 02:35:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 483C98E0001; Fri, 27 Jan 2023 02:35:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 356246B0071 for ; Fri, 27 Jan 2023 02:35:33 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 089C0A08D3 for ; Fri, 27 Jan 2023 07:35:33 +0000 (UTC) X-FDA: 80399768946.20.CE5D0D2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf28.hostedemail.com (Postfix) with ESMTP id EB37FC0005 for ; Fri, 27 Jan 2023 07:35:30 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NhX5PZ76; spf=pass (imf28.hostedemail.com: domain of leobras@redhat.com designates 170.10.129.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=1674804931; 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=AOQxAgAAK0FHDcI+jB5U3fyhR/dhMwJss/kdGg+mJds=; b=aZA42MRtgprqDERye4eSqCyboJQzny5uebBd8EJGTT9wRvtSqSG4DVMhbcn2++GH3mI17v uWmkH5usv5XVq/nGmFQZ1+S0l0NQmuGKMNx0shY7IrwZ2uVTLV1TA4edCMPi/CUxU2tz6q /nZ9lRWqCgZgLaAS3ji30QeBq3OyQ2Q= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NhX5PZ76; spf=pass (imf28.hostedemail.com: domain of leobras@redhat.com designates 170.10.129.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=1674804931; a=rsa-sha256; cv=none; b=V2hAcc6PQklIb2j5d+QUd+CcwD99TOQxP9kVFXIQRTfJJlSPiLSymxdXKRHqJg3JGkuqsn YBKW4hJ7T086GvScXRJiYKULNukn6vsmjaBI6wRY/m/tS1KGsqF+XJToXn8CWJW+rVC/sz hr1YWdjFcXEHfFFaXZW7k4TPDLj1oPg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674804930; 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=AOQxAgAAK0FHDcI+jB5U3fyhR/dhMwJss/kdGg+mJds=; b=NhX5PZ7681qynWPUrWTadTCqSE00zaRsie31izol5b2ehfv0E8nfJIuC8SFw5fKsORzvmw pruJmdM3RbyXcHBe8+o7pd1uvsETF+rXVN7pCWYfB2lOXKVh95YYqH1XeoGKUXIEcG1G2y flSUkU1bqbjurbbFtL/zGbIVMcew/h4= Received: from mail-oa1-f72.google.com (mail-oa1-f72.google.com [209.85.160.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-547-zcx2T79UNQS9knSWcXeavg-1; Fri, 27 Jan 2023 02:35:27 -0500 X-MC-Unique: zcx2T79UNQS9knSWcXeavg-1 Received: by mail-oa1-f72.google.com with SMTP id 586e51a60fabf-1635219ca43so1360477fac.0 for ; Thu, 26 Jan 2023 23:35:27 -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=AOQxAgAAK0FHDcI+jB5U3fyhR/dhMwJss/kdGg+mJds=; b=WC6FGoPkblpJZ/nbEYDwgewpfKmQ6PJYx9jzj1PzwucNmM56iNwryp+CW898Y4yfmG ulHubArphxO5EAL/FrxHXRge2YpMWu1HqEDbZjteDedcUIX9RqHg6h6jpPOTbbA30qD8 fDoTemGZEjteWWj/MbzsZixV++eOGVmz3qaI3cokuDVjMPaaovgI2uNzVgAeGMBlI7OQ RHmqFX3l+V699KBGRswKBaL9W7uNlcSiIA1DBTKaqE9sSPYzZojwbikcsT/nFqsJCFEm UMO72Zh+9CwCyUu1WroNtm6mhWk8CemjHAA0V8QEzBLFMwrLWBhQLFNZ/j3LIu1/KkZY E1Pw== X-Gm-Message-State: AFqh2kooPBDKGFgneklPuUQlrvcAVjvlfqNu7TVGHb7Hp75n/e8lBWY3 FcYlpHVsjHvyPtYi8AruPa960LPVEcgb4lwGB6mXaW/vWnfNnFOGIRhTPXJ3YIUB2cJAn5ekzZh sIpPmi8xsH94= X-Received: by 2002:a05:6830:2477:b0:686:6cf1:1cb3 with SMTP id x55-20020a056830247700b006866cf11cb3mr13732065otr.13.1674804927000; Thu, 26 Jan 2023 23:35:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXtTdCpwGeK5oWchZcZI01VdWJ8sxsZP+9IEvbdt5720U4H1aYd/ws6aYZNtqySF3kyS2GdjQQ== X-Received: by 2002:a05:6830:2477:b0:686:6cf1:1cb3 with SMTP id x55-20020a056830247700b006866cf11cb3mr13732060otr.13.1674804926780; Thu, 26 Jan 2023 23:35:26 -0800 (PST) Received: from ?IPv6:2804:1b3:a800:6912:c477:c73a:cf7c:3a27? ([2804:1b3:a800:6912:c477:c73a:cf7c:3a27]) by smtp.gmail.com with ESMTPSA id cp11-20020a056830660b00b0066ca61230casm1476844otb.8.2023.01.26.23.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 23:35:26 -0800 (PST) Message-ID: <15c605f27f87d732e80e294f13fd9513697b65e3.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: Roman Gushchin , Marcelo Tosatti , Johannes Weiner , Shakeel Butt , Muchun Song , Andrew Morton , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Fri, 27 Jan 2023 04:35:22 -0300 In-Reply-To: References: <20230125073502.743446-1-leobras@redhat.com> <9e61ab53e1419a144f774b95230b789244895424.camel@redhat.com> <55ac6e3cbb97c7d13c49c3125c1455d8a2c785c3.camel@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: mhm45cxkm18he5zbtjuxwr1ga7hsdwaf X-Rspamd-Queue-Id: EB37FC0005 X-HE-Tag: 1674804930-77669 X-HE-Meta: U2FsdGVkX1+Q/wkN40Jb7m5HTNCpC5DOEzRWf4yf+vfeBSgLXv2sblNysu1s2/tFyaw7a07totMq+zOH4Uw+uceShYeW0aRZ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mj47nNnRKdQ18jsev/Ux8JhQNz21OZ738MyrXyRih/WcaE9TWKpXYzyaJsGZcOPGY67UzF/LotPwIgw7ROxgcUqY7Q5aW2HZo8HkMX8zhlhTdDoLt90j74/EdlTaHDBuRKiac9pD01ptKNJe0qlALvjyKIcH2GloFy0A9nQs8bVRM/4N85rrFYATpsqKL6b4qT7neywjDiNscGUP353ZuSGjCotbUcbHjBajxWMMtV4mYP/C4bvk8epDsqCnLdg== 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 Fri, 2023-01-27 at 08:20 +0100, Michal Hocko wrote: > On Fri 27-01-23 04:14:19, Leonardo Br=C3=A1s wrote: > > On Thu, 2023-01-26 at 15:12 -0800, Roman Gushchin wrote: > [...] > > > I'd rather opt out of stock draining for isolated cpus: it might slig= htly reduce > > > the accuracy of memory limits and slightly increase the memory footpr= int (all > > > those dying memcgs...), but the impact will be limited. Actually it i= s limited > > > by the number of cpus. > >=20 > > I was discussing this same idea with Marcelo yesterday morning. > >=20 > > The questions had in the topic were: > > a - About how many pages the pcp cache will hold before draining them i= tself?=C2=A0 >=20 > MEMCG_CHARGE_BATCH (64 currently). And one more clarification. The cache > doesn't really hold any pages. It is a mere counter of how many charges > have been accounted for the memcg page counter. So it is not really > consuming proportional amount of resources. It just pins the > corresponding memcg. Have a look at consume_stock and refill_stock I see. Thanks for pointing that out! So in worst case scenario the memcg would have reserved 64 pages * (numcpus= - 1) that are not getting used, and may cause an 'earlier' OOM if this amount is needed but can't be freed. In the wave of worst case, supposing a big powerpc machine, 256 CPUs, each holding 64k * 64 pages =3D> 1GB memory - 4MB (one cpu using resources). It's starting to get too big, but still ok for a machine this size. The thing is that it can present an odd behavior:=20 You have a cgroup created before, now empty, and try to run given applicati= on, and hits OOM. You then restart the cgroup, run the same application without an issue. Even though it looks a good possibility, this can be perceived by user as instability. >=20 > > b - Would it cache any kind of bigger page, or huge page in this same a= spect? >=20 > The above should answer this as well as those following up I hope. If > not let me know. IIUC we are talking normal pages, is that it? Best regards, Leo