Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751327AbdFDUb0 (ORCPT ); Sun, 4 Jun 2017 16:31:26 -0400 Received: from mail-pf0-f180.google.com ([209.85.192.180]:35355 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751197AbdFDUbV (ORCPT ); Sun, 4 Jun 2017 16:31:21 -0400 Date: Sun, 4 Jun 2017 13:31:16 -0700 From: Yu Zhao To: Vladimir Davydov Cc: Johannes Weiner , Michal Hocko , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, n.borisov.lkml@gmail.com Subject: Re: [PATCH v2] memcg: refactor mem_cgroup_resize_limit() Message-ID: <20170604203116.GA19053@google.com> References: <20170601230212.30578-1-yuzhao@google.com> <20170604200437.17815-1-yuzhao@google.com> <20170604200942.GA23523@esperanza> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170604200942.GA23523@esperanza> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 720 Lines: 18 On Sun, Jun 04, 2017 at 11:09:42PM +0300, Vladimir Davydov wrote: > On Sun, Jun 04, 2017 at 01:04:37PM -0700, Yu Zhao wrote: > > @@ -2498,22 +2449,24 @@ static int mem_cgroup_resize_memsw_limit(struct mem_cgroup *memcg, > > } > > > > mutex_lock(&memcg_limit_mutex); > > - if (limit < memcg->memory.limit) { > > + inverted = memsw ? limit < memcg->memory.limit : > > + limit > memcg->memsw.limit; > > + if (inverted) > > mutex_unlock(&memcg_limit_mutex); > > ret = -EINVAL; > > break; > > } > > For some reason, I liked this patch more without this extra variable :-) Well, I'll refrain myself from commenting more because we are now at the risk of starting a coding style war over this.