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 541CFC433F5 for ; Wed, 12 Jan 2022 00:25:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC0926B00FE; Tue, 11 Jan 2022 19:25:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A48E46B00FF; Tue, 11 Jan 2022 19:25:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E98D6B0100; Tue, 11 Jan 2022 19:25:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0171.hostedemail.com [216.40.44.171]) by kanga.kvack.org (Postfix) with ESMTP id 7B1796B00FE for ; Tue, 11 Jan 2022 19:25:54 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3A9FC8008F for ; Wed, 12 Jan 2022 00:25:54 +0000 (UTC) X-FDA: 79019742228.05.B157CD2 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by imf16.hostedemail.com (Postfix) with ESMTP id C29E018000E for ; Wed, 12 Jan 2022 00:25:53 +0000 (UTC) Received: by mail-ed1-f46.google.com with SMTP id i5so3014990edf.9 for ; Tue, 11 Jan 2022 16:25:53 -0800 (PST) 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=MBSCVEXhAMvxGQvNiGRyMSUYqls1w/ZtyRRzB2dpPmI=; b=QI+s8v0B1JsKNZCuCjjyuOlaCkg7jITbixgszmCrLpMZfPFYpHcAX1zqszo8unsiV1 jsXZXHhaNIzmLJ+roOqKNxX9oQd7UZWzN866zq13FqgZilLSTkSBnUEqo73zTKiEjRq/ CnJobd7MTSnyH8IU9TEWr9ISjl5BvrRRYYjXIqXt7qqpLBGrbQZOtcq4IhaJ5GaKu/5k J2ps1fNM5z+9O3Q95GSfTF4OJbsUEa8X4bFjF8s5n4xExrLJPbnuPLwqlax+TzaxKY1d 6mmOOny0tBQfGXQv9bn8dajnX2FKEuJ8kTbmbN09UEcwk9DHm8SFfRfEgLQbICUGbL5Q GtBQ== 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=MBSCVEXhAMvxGQvNiGRyMSUYqls1w/ZtyRRzB2dpPmI=; b=7J2MsfrDvJ3BMkzPMGCYyrqExevdgLRMBpmaeV5HsfFF8REEVG4bd43on758rUvoRd 0D85UixB6Bqguqn488FfgDVO/e0pwffXimOD2Xy5PTntUFOrEBJt651jTsK5gud1S0uv SZchgpttqGmMJBHIK36Ex2D2OOIj892YjnmBnCJhl3kdJPFmi2T07neVExXocrIbTf65 cROTg+KzgmsppVlOtsizBNLlrQpE+PMCrDF3bUimSfPFvuRzQt0Ht3xcP0ZhVLQ5tRCn VsbxUnm4d+NfshUbdq91loI861Od+6zfHTVi3nPhu3QctRe9Mzb6zzr6MNrG+FKohkcf kcKw== X-Gm-Message-State: AOAM5309d6n1IhQuS++BLzXnCcbUQkUKR9Ev57wZD4L3PkrLwbsLJg0F rjbyXKPQBeMtDBGFMjLSSso= X-Google-Smtp-Source: ABdhPJzdLpSS1YpaJUsL8RlI3c1NNGcmdwOWn04iBHPvItNbG4K6mk53eeTC900OYuWUEnENJusF7Q== X-Received: by 2002:a17:906:69cc:: with SMTP id g12mr1090415ejs.372.1641947152680; Tue, 11 Jan 2022 16:25:52 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id j5sm4026441ejo.171.2022.01.11.16.25.52 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jan 2022 16:25:52 -0800 (PST) Date: Wed, 12 Jan 2022 00:25:51 +0000 From: Wei Yang To: Roman Gushchin Cc: Wei Yang , hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, akpm@linux-foundation.org, shakeelb@google.com, vbabka@suse.cz, willy@infradead.org, songmuchun@bytedance.com, shy828301@gmail.com, surenb@google.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 4/4] mm/memcg: refine mem_cgroup_threshold_ary->current_threshold calculation Message-ID: <20220112002551.sksmoril2nwuddtu@master> Reply-To: Wei Yang References: <20220111010302.8864-1-richard.weiyang@gmail.com> <20220111010302.8864-4-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-Queue-Id: C29E018000E X-Stat-Signature: cf9kkjdto8ry173ikr7a9857u4hpss4i Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=QI+s8v0B; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.46 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com X-Rspamd-Server: rspam03 X-HE-Tag: 1641947153-936563 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 Tue, Jan 11, 2022 at 10:23:41AM -0800, Roman Gushchin wrote: >On Tue, Jan 11, 2022 at 01:03:02AM +0000, Wei Yang wrote: >> mem_cgroup_threshold_ary->current_threshold points to the last entry >> who's threshold is less or equal to usage. >> >> Instead of iterating entries to get the correct index, we can leverage >> primary->current_threshold to get it. If the threshold added is less or >> equal to usage, current_threshold should increase by one. Otherwise, it >> doesn't change. > >How big is usually an array of thresholds? If it's not huge, likely >any savings won't be really noticeable (it's not a hot path and there >is an rc_synchronize() below). Usually the size is small I think. > >So I agree with Michal that a better justification is really needed. Yep. > >Thanks! -- Wei Yang Help you, Help me