From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753162Ab0KGWPK (ORCPT ); Sun, 7 Nov 2010 17:15:10 -0500 Received: from zene.cmpxchg.org ([85.214.230.12]:45340 "EHLO zene.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711Ab0KGWPI (ORCPT ); Sun, 7 Nov 2010 17:15:08 -0500 From: Johannes Weiner To: Greg Thelen Cc: Minchan Kim , Andrew Morton , Dave Young , Andrea Righi , KAMEZAWA Hiroyuki , Daisuke Nishimura , Balbir Singh , Wu Fengguang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [patch 0/4] memcg: variable type fixes Date: Sun, 7 Nov 2010 23:14:35 +0100 Message-Id: <20101107215030.007259800@cmpxchg.org> X-Mailer: git-send-email 1.7.2.3 User-Agent: quilt/0.48-1 In-Reply-To: References: <1288973333-7891-1-git-send-email-minchan.kim@gmail.com> <20101106010357.GD23393@cmpxchg.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, it is not the res counter primitives, these are our own counters. We have to keep signed types for most counters, as the per-cpu counter folding can race and we end up with negative values. The fix for the original issue is in patch 1. There are no casts needed, the range is checked to be sane and then converted to the unsigned type through assignment. Patch 2, also a type fix, ensures we catch accounting races properly. It is unrelated, but also important. Patch 3 implements the idea that we only have to used signed types for _some_ of the counters, but not for constant event counters where the sign-bit would be a waste. Patch 4 converts our fundamental page statistics counters to native words as these should be wide enough for the expected values. Hannes