Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8204252ybl; Thu, 16 Jan 2020 12:26:05 -0800 (PST) X-Google-Smtp-Source: APXvYqwKmiTF3I6UslZMfzYJsDmsWRvis2HnjfnF6JKsXQWIRkgazqliluuf+N6yqdwUZYRij0nc X-Received: by 2002:a05:6830:214d:: with SMTP id r13mr3528481otd.225.1579206365438; Thu, 16 Jan 2020 12:26:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579206365; cv=none; d=google.com; s=arc-20160816; b=XMnbvOb5NCoAouQIgnk6LKTnKQSGISVnptwvnFC6negTMnw2kYiefcMcpRk8yyJntU C+UTpD0AkCLfqDXejvWIE33F4l3NYm3L5TIptsCpoMwQqFM3cHGV2ohnezDeWBUuMNb7 owB4t3QBGZbY2uFGF0rhj80yPOJsBgctp5K3z9udG3fQ+i2JtIlUbtQ5KRs4wC+8hieW at7ITsSswZgz6A41NQAMH9Ddy3M8tWQBG/Np5XkIxLnrUPeTS8gr1PjZXWVTs6x1IICj QLcd3dY7LYZ/kfj9YQHUspAo/bh/hNkTwF7qPUeeykXLbI0cSdTpwtQMHBM5/OJFAN1z ZHAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Paj9ZIyLKDeb3eXWIMYy+oZ8ADw3i4uQICVjpw67tFk=; b=Htg0XbgkmS1M2CvGU+Lk6q+aGmGMUK9VWQpm8yziEJNjh8DDCgTe/pJlzStqhlCaxZ 7628XS+FpAE81HZ8pSLm6xYZOVFEq1/2fgZ2dEzCwPzcnuZPmpkjx6AvpSp0JDcZiZ6W lvvL12M3GlQyrwScAyxW83oTc0gDWU131hDMWS+P6ZdVi2M2HTf+Vk6YdV1uuGEgN7P1 GcC4nynOlfOqzK9PAyuZqpQzSki0OtKT4/P64R3u0UAtwM6LMXJXAELgBHHi+6g+1jsC OnCtXRld2oiO7Kor6bKhy5SgnOPY4/3fd6kHe+8km/4XTc9oz7BMnPqWp59WAKr2KMR3 axuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=f2RCFwWZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e190si12647963oib.113.2020.01.16.12.25.53; Thu, 16 Jan 2020 12:26:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=f2RCFwWZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392428AbgAPR1M (ORCPT + 99 others); Thu, 16 Jan 2020 12:27:12 -0500 Received: from mail-qv1-f66.google.com ([209.85.219.66]:43271 "EHLO mail-qv1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392379AbgAPR1C (ORCPT ); Thu, 16 Jan 2020 12:27:02 -0500 Received: by mail-qv1-f66.google.com with SMTP id p2so9398958qvo.10 for ; Thu, 16 Jan 2020 09:27:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Paj9ZIyLKDeb3eXWIMYy+oZ8ADw3i4uQICVjpw67tFk=; b=f2RCFwWZ11DI7in6/E+nFTYJ/u5RhRB+ZcKR2iC205+oCb21iMfwSFsEqOJN3H8VsI QW3pUdOZLXChDAAUgzZgtfQI8uccUzbiveaULWwIGSd4S67ncfmjez1twkBLg761dJ8L 7GPnTtbkKaT4bKXm8l+TgIgRZbbSxG+nb1dBpwzThrY+rvMw63iVaHyQ7wZf7wWjn8/O Z1zPbfaxyCtckJQLr6sU8kaAn9f5kyHg8C607d1QBUoB9E315ZuqrBB2rhElPX6mFtw2 ETButUBNGsuL5LQactvYsfc6mC+it7K5eh6Qy3PAKfi7J1X0BJwbktPM2/RUrZLNeCBZ EseQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Paj9ZIyLKDeb3eXWIMYy+oZ8ADw3i4uQICVjpw67tFk=; b=kHzIOZ8rYtN+3I23UhY65YDpgdMxqHx+SkhFUNG5IgvmJY7CzLrnkq0ZWdHSkU30Vz gxuwYC/guH840hJAZGx+4BpvwqqtE+wCQRPDyk2F6SfTE+h5bnCJHYwRS0SEpTM+YIVl KQplDZw4VQVXZh2Wa15Ug+P3rud5owDwWo8BCZIB/bbwPUDWpPp1W5M+6s/W4C+32QhP oxsUNdXaLxo95c7xlmMx1tG+QAqPy95pYUcjajEj7S1miVQckPUUaMUt4EGSbchkTvpf i2rD8/v/Q9NRST+KfHyEGGPERd2fen/8tI1pSyrgC26YoHsxHKAYd375BAg5/AUvJpl9 qeiA== X-Gm-Message-State: APjAAAWzj6N7Pb4wj1RRluvTKmxX+e9g5Ri85TmP4PWB9A9w2e6PY6r8 Y9MlxjCFggKxksR4qEE7L3vM0A== X-Received: by 2002:ad4:5586:: with SMTP id e6mr3710258qvx.92.1579195620917; Thu, 16 Jan 2020 09:27:00 -0800 (PST) Received: from localhost ([2620:10d:c091:500::ae73]) by smtp.gmail.com with ESMTPSA id v7sm11862980qtk.89.2020.01.16.09.26.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 09:26:59 -0800 (PST) Date: Thu, 16 Jan 2020 12:26:59 -0500 From: Johannes Weiner To: Roman Gushchin Cc: linux-mm@kvack.org, Andrew Morton , Michal Hocko , Shakeel Butt , Vladimir Davydov , linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH v2 5/6] mm: memcg/slab: cache page number in memcg_(un)charge_slab() Message-ID: <20200116172659.GE57074@cmpxchg.org> References: <20200109202659.752357-1-guro@fb.com> <20200109202659.752357-6-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200109202659.752357-6-guro@fb.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 09, 2020 at 12:26:58PM -0800, Roman Gushchin wrote: > There are many places in memcg_charge_slab() and memcg_uncharge_slab() > which are calculating the number of pages to charge, css references to > grab etc depending on the order of the slab page. > > Let's simplify the code by calculating it once and caching in the > local variable. > > Signed-off-by: Roman Gushchin Acked-by: Johannes Weiner