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 07E66C433F5 for ; Mon, 14 Mar 2022 23:05:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 65DA66B0071; Mon, 14 Mar 2022 19:05:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 60B2C6B0072; Mon, 14 Mar 2022 19:05:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4ADAB8D0001; Mon, 14 Mar 2022 19:05:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 3BE1F6B0071 for ; Mon, 14 Mar 2022 19:05:51 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id F0A4D24604 for ; Mon, 14 Mar 2022 23:05:50 +0000 (UTC) X-FDA: 79244526060.07.03D58C4 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by imf20.hostedemail.com (Postfix) with ESMTP id 6FFF11C000B for ; Mon, 14 Mar 2022 23:05:50 +0000 (UTC) Received: by mail-ej1-f47.google.com with SMTP id gb39so37073809ejc.1 for ; Mon, 14 Mar 2022 16:05:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Qviwn+qqmEMoumEZT2BJtbr5DY+V57MiiCdripFWHEs=; b=oWwPhqNJsbdbfbBEvYxrbM0l6Anq0/f5kesf3PtfoAYrvrPg0pv3IZh1/A9zTnTx++ eWJ/nZLUEdArGsuk25+IHuZA6tO1dK2E8uTUfmZzYzSJ28Oya28iZ1W74uc0T5DcfmZG RI5GDkYYG4dKRoL6xf34peOMoUHy2JqYZoSbzHkg3wNLPo5fEoFsn3pOcZ0m2nW2AFtB S02gITXU151YZ7SeK9tv+xerQaq4J/IF2de6aMO1Qd/gYePQlogovXbOmGIP9kMz8JRm ZfaGBrHO1Vy2N4tKxhclnKj074FuOSdgE0zQQxk0SynlzkCIScyZZQTgsZmysNBjnPPF JQcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=Qviwn+qqmEMoumEZT2BJtbr5DY+V57MiiCdripFWHEs=; b=SYYdL1H5CzWj0UUvys38tBdqcgmtkpXR3sZIWOLULsy67/pSxM/6UyYf19oImoy4ho 9x3wK8Q4DzAdT1Bv1W4tsQCzt17YvP3rvWHSFn3PY32Gjgt7U4vR57KIH7QDg9jOlCVJ 2XUpxns3mCBlF+NiJLIiaIZ1XGm58xgn48Olur2Ub34J9+nHFswyIwcdoMlCPmAFBGoI 85F+imruzlagALI4qHbqBYya5/Cz7IWfBbe0UmQSu9qnFi4qd4Ul4R0ItSIR06q3nU1s xsv/I0EadGsIWBMto4TJ9tsEK+oVdEYyLchlpOSnlyUDFGmIZX+0pcqFzM4ss0SZEJp7 ELzQ== X-Gm-Message-State: AOAM532Cv5bX9CAxc5oJN18pVGnhg02oR0Om2ueXfdJqWBKAe1LSeI5Z 94Af5WTB3t01HCfgRDOOU3A= X-Google-Smtp-Source: ABdhPJxHgz2JPy5b0xn1sH77pqHfHXBZibuYxyiNvQF1Sc9W9ZEicH98JO7j/VJdFZVmwl9D1YElSQ== X-Received: by 2002:a17:906:2584:b0:6d6:e5c9:221b with SMTP id m4-20020a170906258400b006d6e5c9221bmr20510612ejb.514.1647299149069; Mon, 14 Mar 2022 16:05:49 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id q5-20020aa7cc05000000b004129baa5a94sm8630861edt.64.2022.03.14.16.05.48 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Mar 2022 16:05:48 -0700 (PDT) Date: Mon, 14 Mar 2022 23:05:48 +0000 From: Wei Yang To: Michal Hocko , akpm@linux-foundation.org Cc: Wei Yang , hannes@cmpxchg.org, vdavydov.dev@gmail.com, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [Patch v2 3/3] mm/memcg: add next_mz back to soft limit tree if not reclaimed yet Message-ID: <20220314230548.wo4colcwqxhhf3mx@master> Reply-To: Wei Yang References: <20220312071623.19050-1-richard.weiyang@gmail.com> <20220312071623.19050-3-richard.weiyang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 6FFF11C000B Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=oWwPhqNJ; spf=pass (imf20.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Stat-Signature: qdqk5ufb9r5jj64kshzmfheiu4xqptza X-HE-Tag: 1647299150-586683 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Mar 14, 2022 at 10:41:13AM +0100, Michal Hocko wrote: >On Sat 12-03-22 07:16:23, Wei Yang wrote: >> When memory reclaim failed for a maximum number of attempts and we bail >> out of the reclaim loop, we forgot to put the target mem_cgroup chosen >> for next reclaim back to the soft limit tree. This prevented pages in >> the mem_cgroup from being reclaimed in the future even though the >> mem_cgroup exceeded its soft limit. >> >> Let's say there are two mem_cgroup and both of them exceed the soft >> limit, while the first one is more active then the second. Since we add >> a mem_cgroup to soft limit tree every 1024 event, the second one just >> get a rare chance to be put on soft limit tree even it exceeds the >> limit. > >yes, 1024 could be just 4MB of memory or 2GB if all the charged pages >are THPs. So the excess can build up considerably. > >> As time goes on, the first mem_cgroup was kept close to its soft limit >> due to reclaim activities, while the memory usage of the second >> mem_cgroup keeps growing over the soft limit for a long time due to its >> relatively rare occurrence. >> >> This patch adds next_mz back to prevent this sceanrio. >> >> Signed-off-by: Wei Yang > >Even though your changelog is different the change itself is identical to >https://lore.kernel.org/linux-mm/8d35206601ccf0e1fe021d24405b2a0c2f4e052f.1613584277.git.tim.c.chen@linux.intel.com/ >In those cases I would preserve the the original authorship by >From: Tim Chen >and add his s-o-b before yours. TBH I don't think this is fair. I didn't see his original change before I sent this patch. This is a coincidence we found the same point for improvement. It hurts me if you want to change authorship. Well, if you really thinks this is what it should be, please remove my s-o-b. > >Acked-by: Michal Hocko > >Thanks! -- Wei Yang Help you, Help me From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Yang Subject: Re: [Patch v2 3/3] mm/memcg: add next_mz back to soft limit tree if not reclaimed yet Date: Mon, 14 Mar 2022 23:05:48 +0000 Message-ID: <20220314230548.wo4colcwqxhhf3mx@master> References: <20220312071623.19050-1-richard.weiyang@gmail.com> <20220312071623.19050-3-richard.weiyang@gmail.com> Reply-To: Wei Yang Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Qviwn+qqmEMoumEZT2BJtbr5DY+V57MiiCdripFWHEs=; b=oWwPhqNJsbdbfbBEvYxrbM0l6Anq0/f5kesf3PtfoAYrvrPg0pv3IZh1/A9zTnTx++ eWJ/nZLUEdArGsuk25+IHuZA6tO1dK2E8uTUfmZzYzSJ28Oya28iZ1W74uc0T5DcfmZG RI5GDkYYG4dKRoL6xf34peOMoUHy2JqYZoSbzHkg3wNLPo5fEoFsn3pOcZ0m2nW2AFtB S02gITXU151YZ7SeK9tv+xerQaq4J/IF2de6aMO1Qd/gYePQlogovXbOmGIP9kMz8JRm ZfaGBrHO1Vy2N4tKxhclnKj074FuOSdgE0zQQxk0SynlzkCIScyZZQTgsZmysNBjnPPF JQcg== Content-Disposition: inline In-Reply-To: List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Michal Hocko , akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org Cc: Wei Yang , hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org, vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org On Mon, Mar 14, 2022 at 10:41:13AM +0100, Michal Hocko wrote: >On Sat 12-03-22 07:16:23, Wei Yang wrote: >> When memory reclaim failed for a maximum number of attempts and we bail >> out of the reclaim loop, we forgot to put the target mem_cgroup chosen >> for next reclaim back to the soft limit tree. This prevented pages in >> the mem_cgroup from being reclaimed in the future even though the >> mem_cgroup exceeded its soft limit. >> >> Let's say there are two mem_cgroup and both of them exceed the soft >> limit, while the first one is more active then the second. Since we add >> a mem_cgroup to soft limit tree every 1024 event, the second one just >> get a rare chance to be put on soft limit tree even it exceeds the >> limit. > >yes, 1024 could be just 4MB of memory or 2GB if all the charged pages >are THPs. So the excess can build up considerably. > >> As time goes on, the first mem_cgroup was kept close to its soft limit >> due to reclaim activities, while the memory usage of the second >> mem_cgroup keeps growing over the soft limit for a long time due to its >> relatively rare occurrence. >> >> This patch adds next_mz back to prevent this sceanrio. >> >> Signed-off-by: Wei Yang > >Even though your changelog is different the change itself is identical to >https://lore.kernel.org/linux-mm/8d35206601ccf0e1fe021d24405b2a0c2f4e052f.1613584277.git.tim.c.chen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org/ >In those cases I would preserve the the original authorship by >From: Tim Chen >and add his s-o-b before yours. TBH I don't think this is fair. I didn't see his original change before I sent this patch. This is a coincidence we found the same point for improvement. It hurts me if you want to change authorship. Well, if you really thinks this is what it should be, please remove my s-o-b. > >Acked-by: Michal Hocko > >Thanks! -- Wei Yang Help you, Help me