From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.177 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796392931; b=ejtuuFr5w7FzILyhCNfZcv7Hb1IdKm+uvopXZHW1U1Ez6iRFYfS9rd1s4Aam/rsKgTlW mdbnzSqfpF4ksCzrp3anugR31ZjlFJy8adfq1erPn4uT75BqgOGUT+eD4zNBW1kixynBA HDaNbhmhlkhcGsF6kck8x7KjcEgHW/o+9NEs1d23mWIb/XLc62oK7EV5zDryVhTHHtRU0 eNCjSHwG+KDTugUrGSIT6KY5VBTQIdGhZS+SrELqpfv7UlrqrvCkogMhcExhE/x4pYE68 Vdvup1jqo0lUicb/P5+7CpcKM5Ygmm7z9M+Nx/1GvruqRoJyKZp7hdK2IcqUrUk7SEQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796392931; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=oV9sX9EAwCFTq7T1QkW7z3OiOvOnTVm1rzxJFWfdbQs=; b=crbP0sbfgHsW2oGK/U9KARIj/zdEnZvaYp47Oy81+V2zLazf2C3brcsOTPrkxqS11dAC uroI1OUTDvwcxtSWq/T6I5lNYsrXCqmCn9Z1pKaUBuKcKID+YAh09IRo/BZrK348m0caH wpn66ks5dZ5uce9L97ZBG/VVD0aWqs2Qq2jqr4TQuU5nttoc5WYxq1qIjfdvh4ZEbZMge AyY1fXbInGkOIZdqSO7AxJxtH5d3ABrKHVwhs9gNU2qCQZwkC+7tlrCir9+m3B0pHHYCA 0rE1yuReW44G9YCPKV/zqKKkFiKbwJEbOUvqhnmleh27k3LLWuqMnDnEW0US6rt2obA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass header.d=cmpxchg.org header.i=@cmpxchg.org header.a=rsa-sha256 header.s=google header.b=Cul1RfrX; arc=none smtp.remote-ip=209.85.128.177 Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 336C7606A32C for ; Fri, 4 Dec 2026 14:02:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 336C7606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.a=rsa-sha256 header.s=google header.b=Cul1RfrX Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-8b4d543b6b6so5887167b3.3 for ; Fri, 04 Dec 2026 06:02:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1796392929; x=1796997729; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=oV9sX9EAwCFTq7T1QkW7z3OiOvOnTVm1rzxJFWfdbQs=; b=Cul1RfrXHkeLb0U4MDQgSC2M0raPT7fSn0o8PTJZw6/Oe9t2lk53lz9LjE/fy1VaSp IsI5VLp+0VPN5Ys3FJ5+vBwi+8KTIjG8gDuHZKPNPIwd/CRFx5TyoNz2fn8tOdxvPbr3 2adjbtUVuN30nXkIrKzUIMqANfbxCHL09rB6UGmK4qp0l0YdQGcgR8rKZvLzbOd465VO JYcy+1961191mUsMtAeAg65gyYq1sB29WqtTedUaFWACf6Ys3aqGpqdvtLg9oDvW8xox m5lQNP0asMz0jurQwRF5pi2oFhMsIWiwluOBt3vhd+HGh3pTys38t3pHJTAZhxT1UIs9 z6PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796392929; x=1796997729; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=oV9sX9EAwCFTq7T1QkW7z3OiOvOnTVm1rzxJFWfdbQs=; b=M0CwDj5ti7JZ5lKomUjR70cJD9QJyBtg4HL9+8IuKBbdk6qyaQ0WIGPAZuje5HDQg9 RB+iunzJP2c/KPt4hdQLgNcY3i0pfphYe/Ci0mz+kB3G0ngugqELOhLpkaIOOeKq9S9I 2BG6UKS0aCtmRUMUVi6DFul+zAF/LlEYUlL/OFuuh8xRdB7cIuIdsoJxSnIKRJf0mhgH lGS3gxKkD9PSO6/udS5w4MJ1VdViQuP+2lVf1XxuQGjcJM50J6m4KndrUyo97td0qLcl Re4e298eC3wur42ZX6iOo3R5nfFonY3dUBdNVo3xMymIu7cNP7AmWDeugsvhb8TLO+1c jHCQ== X-Forwarded-Encrypted: i=1; AL+hErHyPFWD/sCgDcymK1pIN25V3m5rKjpuXB2U8VQeH22CDH6NbQ1dM3u+VXyM61s5Xv3MDj3NjlvL@vger.kernel.org X-Gm-Message-State: AB4q+uFCBtVLrS9TRIWNSJAbeI3em2B94PFH9Yi6Hcy1WLuXBxKyVTlx bAbf4lftnv7A3nbNkYtkx8EwwhRYSj1lzAeevamflg++S2NfQcKRmSCv3FYyGgSaKEY= X-Gm-Gg: AZFdTZeXmBxx3EArEZ5nAsQfm2leEjiMVCPYRqzHsPGA29B3xm/GxapYACj6fMKlER7 yPnthfRj6i5T0Z/JabzMwTdiV4dPLirdECwhajf2L18QWsTo7B7CvNbS/aqJuByMEdwZOCp3EdP ulnKUkhqJSVgUwkB8etH7IrEUEaSil13tWTaD/GeyUmADts+F6ZKScZolODFUh4mnLxjEHwKPP4 U/offn+9VQFLRXM1dH2gXo41LIh23Dq26H0crGV/8KFSFtCkOXosTTEXrPIvFKVoKICX83UlaQx cS5S8XGlQRBy5iawoWqcYxp98gQAIHi7SH8kPKSpUWcOazpU3UWbuiNcYkwBGbgcrHja6w+Os8k c8KacDZ2vp9QwQGCgz33l/QY4rp6OIKvpG9mxW4pjXhPYNN0TxH3EV82e6/B5NIlnkqEGRCa1eM QCh0BsAHpMHxJc/zbJIqrBIrpnRZZYd87yHMbGfPAxiDCFyGUekAmfJ+9d3FE8bbtjrcaEOJSjO 53IehJ85XDV+FBMxsi34dOj79hd2FIDswcVwRTXIFUX/kGEF6tcMbSkTPDUZv0NKOROgO0n127m gRpShDVcliD+rPIiUVt9EIQEGg== X-Received: by 2002:a05:690c:4913:b0:8b4:deb1:4aee with SMTP id 00721157ae682-8b659da20a1mr8621907b3.14.1796392928878; Fri, 04 Dec 2026 06:02:08 -0800 (PST) Received: from localhost ([2605:8600:200:dc6:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b660d8463fsm9970407b3.26.2026.12.04.06.02.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 06:02:08 -0800 (PST) Date: Fri, 4 Dec 2026 09:02:07 -0500 From: Johannes Weiner To: Hui Zhu Cc: Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Chris Down , zhangjiao2@cmss.chinamobile.com, Alireza Asgari , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hui Zhu , stable@vger.kernel.org Subject: Re: [PATCH v2 1/2] mm: memcg: fix zero throttle delay on 32-bit kernels Message-ID: References: <1ef1fa130f9bd4a94bf92335486729f05034c30d.1796367145.git.zhuhui@kylinos.cn> X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1ef1fa130f9bd4a94bf92335486729f05034c30d.1796367145.git.zhuhui@kylinos.cn> On Fri, Dec 04, 2026 at 03:18:19PM +0800, Hui Zhu wrote: > From: Hui Zhu > > calculate_high_delay() stores max_overage * max_overage * HZ, computed as > u64, into an unsigned long before shifting it right by 34 bits in total. > On 32-bit kernels the store truncates the value to its low 32 bits, so the > shift always yields zero: memory.high and memory.swap.high throttling is > completely inert there. And since the caller reads "penalty_jiffies <= > HZ / 100" as "nothing to do", the MAX_RECLAIM_RETRIES reclaim loop is > skipped as well. > > Keep the intermediate in u64 so the shifts see the full width. Also make > the function return u64, and the caller's penalty_jiffies u64, so the > value is narrowed only after the caller has clamped it to > MEMCG_MAX_HIGH_DELAY_JIFFIES. Nothing changes on 64-bit kernels, where > unsigned long is already 64 bits wide. > > Fixes: e26733e0d0ec ("mm, memcg: throttle allocators based on ancestral memory.high") > Cc: stable@vger.kernel.org > Signed-off-by: Hui Zhu Reviewed-by: Johannes Weiner