Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp144730lqa; Fri, 26 Apr 2024 18:15:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV4zf7UBIlkwY+zawAdDdE3HPjhUdUXx/CJc77MQtKXrr0DgeAI7L0i116lnn2u9J0S2Yg/Fe6FE5yC7+GY+HH2JttanQl7+f7L3BM2Jw== X-Google-Smtp-Source: AGHT+IHiZXc6p9oBTIfYDpuGRaydELJ4nAnMG8g+s1i61NsY/R470l3hlEUU+fE8bgBF2zch5+es X-Received: by 2002:a17:906:32d8:b0:a52:62a2:d727 with SMTP id k24-20020a17090632d800b00a5262a2d727mr2826872ejk.52.1714180530691; Fri, 26 Apr 2024 18:15:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714180530; cv=pass; d=google.com; s=arc-20160816; b=qBEv0rOjolMZPagIDQe2disJzGWRzzsbkj/xQahtY3MlnihcYXPM+4+7R1llYd1b6j QNBWuSnpGI3640gFzIIKMr1Bub7jwG4dCCiCTHsU+VTl8XgmzBX2pof0BgQImROfno94 Y4i1VrMw9GrLzfwbi5lb+oiTq2qjamPhxlVSoOY/gzKo1irRQOx9VsPSD0L57y/4af9Z sca69F7XCY9jVGMIdOKRx5XHV9VhREJxb9ZMtEj1c1KMSmdxkB0TWpR0Q2Rabv5/NVhU rNoH/4rUokZNi+Glu4095lX/knSkkIz0gpM781tiUaM9i57TBWff7HIZwRNhsdmiXT60 Sgkg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:dkim-signature:date; bh=7onvPrSnv4zk2ACGNhrsA4mgLdVhUxihzE/0ThcanU8=; fh=ifesyHm7lGxO6oBP0o4ljVxzoEpCEqENJ0ry8d3xcQE=; b=u6ztNVOjNTKYB9AZ4s8m2XihO/Zg58cLNSJA0yY03mw+MsyZRYkU9YIUDFwY32UELr qfyLwHRqealYcx4S29Xl557X335t1/BPPA0SATdcBckxKreslya0uEWRJUaP1vUxEcWT 9pgvSdQBOjLUHumK4D8A0HV806fAzwyn4BlOI4Y1FMbDsAa402HqnnMRarhqU9tBkjLO YpXjmpuhDLLB8IvkqR36YiWWXeDS5ORLnVNkraBmz0Nfoq+VGoaAFBp5H5G8LZWxy+ad 9ud5E58zFJS0SZTCTKeUB1igcy7wWMXvydUbhZT8dpK3miTCTaEYtdZM/HJDAu0gDrO4 6Bdg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=NTrlNAsR; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-160838-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160838-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ox8-20020a170907100800b00a51946ff633si11837468ejb.990.2024.04.26.18.15.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 18:15:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160838-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=NTrlNAsR; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-160838-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160838-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6C3491F22936 for ; Sat, 27 Apr 2024 01:15:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 58C372E651; Sat, 27 Apr 2024 01:15:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="NTrlNAsR" Received: from out-171.mta1.migadu.com (out-171.mta1.migadu.com [95.215.58.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 943ED2570 for ; Sat, 27 Apr 2024 01:15:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714180522; cv=none; b=R7Qe2Ar0IJZBbw70XxG2I5SawmyvFnEZaGQnf4//eF8fxzowU5u0g3CTzMnVEnIQJI70R3ciMGtm66LSUx0zllovXCF5plAB15bKAqwSTWcRiBMzhcULS3N6CjumCrRTAkfgv0wf+HafTr+wUQdyd//ecZVyUqtZtS2PoM6/qfI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714180522; c=relaxed/simple; bh=LYF/0EjxExzZ7UQI2Z9XnIu4tPB09xytMqOIKCPsi4M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FxMCVLKtbyKoD06R2dXwyPKm+cpZhZF4N8DPB9ly6vTAebzHM5ORq0nBqF4Li/StwGvfNtan/mfqYJkfhOjKLNs6RZ3ohTIa/S85f36uYtb46yfi6nqeLz0KOyfOyyMCqesPqgCG8fUW1m4BkFQatEFi46BEMz/ZgETjKoh1K70= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=NTrlNAsR; arc=none smtp.client-ip=95.215.58.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Fri, 26 Apr 2024 18:15:14 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714180518; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7onvPrSnv4zk2ACGNhrsA4mgLdVhUxihzE/0ThcanU8=; b=NTrlNAsRURAWfw5UqZv5+bw43WmHjK6ABGB2u11bVCshH9h87ma5dT/Ybbaf2gmjGCOqdh 4Q73lcmI0pobOAT+nNUba+ukZ3Dq3/Nm81/gNhnwoMLE9sbUxl3LL/iJJ428/qqiRjHjlR /kjEMjI1qJRumv0bLfk6WLZ9B9PsXb4= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Yosry Ahmed Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/7] memcg: reduce memory size of mem_cgroup_events_index Message-ID: References: <20240427003733.3898961-1-shakeel.butt@linux.dev> <20240427003733.3898961-2-shakeel.butt@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT On Fri, Apr 26, 2024 at 05:42:48PM -0700, Yosry Ahmed wrote: > On Fri, Apr 26, 2024 at 5:37 PM Shakeel Butt wrote: > > > > mem_cgroup_events_index is a translation table to get the right index of > > the memcg relevant entry for the general vm_event_item. At the moment, > > it is defined as integer array. However on a typical system the max > > entry of vm_event_item (NR_VM_EVENT_ITEMS) is 113, so we don't need to > > use int as storage type of the array. For now just use int8_t as type > > and add a BUILD_BUG_ON() and will switch to short once NR_VM_EVENT_ITEMS > > touches 127. > > Any reason not to use uint8_t (or simply u8) and U8_MAX (instead of > the hardcoded 127)? > Just to keep the error check simple i.e. (index < 0). If we hit 127 then we can switch to uint8_t and S8_MAX as error. Though 127 should be replaced by S8_MAX. Somehow I was grep'ing for INT8*MAX variants. Anyways if there is more support for uint8_t, I will change otherwise I will keep as is.