Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751347AbdFDUKA (ORCPT ); Sun, 4 Jun 2017 16:10:00 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:33026 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751301AbdFDUJr (ORCPT ); Sun, 4 Jun 2017 16:09:47 -0400 Date: Sun, 4 Jun 2017 23:09:42 +0300 From: Vladimir Davydov To: Yu Zhao 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: <20170604200942.GA23523@esperanza> References: <20170601230212.30578-1-yuzhao@google.com> <20170604200437.17815-1-yuzhao@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170604200437.17815-1-yuzhao@google.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 504 Lines: 15 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 :-)