From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 BD5A336AB5E for ; Mon, 23 Mar 2026 08:24:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774254277; cv=none; b=KExPa117mLIaoxVS7gQhLsVChksmbeoIVo5XhwkRls/s9xmfLXH94Wd5qNhhH97gM4CfUawdl8a6dw9sZJxGs1AuPYrPlT3cjPcj2JMxpRznsEHlKOJvFoOW9B4WUy6u5nqAhjESt6ljzbZV/iGSglDQXi4CdDFADTNGqkWEibA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774254277; c=relaxed/simple; bh=df45W3b6valvoQMlkMLb0VHRpJX8Uz+L2ySSMYD4XXk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JI+IpbSDOGEO643Qn1NQPf1hWra44F6l8bmnzUwMi1CNlflKRq7uHOzsqHFB2uzwA65rEre2PC4kNmgGmMMvnTjkkKZyHMVgf9EtAswMzkNb1AOpKtUobmrwRBewrZAc3pFzfbY0MNIOBuJSxNsSxbm6fTg7ayREok598XrNB48= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=FZ0s0zSz; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=c9FYhFWW; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FZ0s0zSz"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="c9FYhFWW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774254274; 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: in-reply-to:in-reply-to:references:references; bh=l4FYRZcJce0iqsefU7RH85JSFRG+Uej7mvnkE77jdLA=; b=FZ0s0zSzjhycAk8kyZrLZC2TO/LH71l2dtiXEGb3Ypr/stFphelQoZ3f0ZqaxsCQwMGTL6 dEhQwwU4DzWM//2p8BNVroVMKFNVn6KZxNUjLxHtuGXBAAQKgq9KTM15RCD5/RprJg3eAO Kvocrrf+nfc1dNLJyVLq4Md4A3MBmAU= Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-UW0LVXi8OWaKbCWv5D6J4w-1; Mon, 23 Mar 2026 04:24:32 -0400 X-MC-Unique: UW0LVXi8OWaKbCWv5D6J4w-1 X-Mimecast-MFC-AGG-ID: UW0LVXi8OWaKbCWv5D6J4w_1774254271 Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2b051befbb8so32311065ad.2 for ; Mon, 23 Mar 2026 01:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1774254271; x=1774859071; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=l4FYRZcJce0iqsefU7RH85JSFRG+Uej7mvnkE77jdLA=; b=c9FYhFWWRi2AaYoVWUfTGwqs/GLD2qRipVQK3OCa2/MIGQQWusjRbYuR5XdMYueUjV UwvMsWav3yfYMo4N03Q7rqcoCqKwGImrHzb9pK0x1mYPewE8x2p85YOFWnLU3NIP/177 KD1NW2Buqb9i8ymifPtr/2KXuAYlBLatqKJt8VAgINXQNVPSYXx8jof/otWW9bwtEJ/C YyNuAlOotLCl+Sxq929n0Wg4xeqKJrvilfiB2CQObpvZbikBm38kI72TzdiVOGhH2FLa xZWakjeO8zKWgb32e/Lh3EQni1WKxq/xUeaIhhb0ev/XOWneML6vPxi+VB+aAlKgyTWi ATcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774254271; x=1774859071; h=in-reply-to:content-disposition: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; bh=l4FYRZcJce0iqsefU7RH85JSFRG+Uej7mvnkE77jdLA=; b=oc9PEygKh9rF0z7bpsQE4tHYqau0PLQ6DXTU/bHYmQGg/tbomLedfnqkzs0HoTw1Fp wS/IW9753lKIQ5O1IwNMq83/tX/6JGj1JlP835wHPpK9p3JH4lmkI2yesN02YOkUg5G9 dCCxCvdwPPWOGX/9gumclx6HfhaeYcEt28+ow5yGrwL9RkRt0vywuV5SNbW7z5E0+rYC ff0wUfumCGlWkvGh3Ptr+i5CJuNQca/nZplqjg+JiJGOrbIvFjV6vxbBSUrqcGPxSR38 80ZTli+o1KT0JQy4hkOGyCmRuYe+nBiuRCL2ApxpRGvAQ5hiSNw2djPm/s3z212JPcgI QqTw== X-Forwarded-Encrypted: i=1; AJvYcCXHrKDMSQaLEDzOp0iVru6iZv5aqbqqJe54n5l2MwW8rQi2Q7syRIioinPyHM6fK0GEK8gLXWKE1KwaWLQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxhuDz3a/EUJXhk3Qn8Pw+zaoEXnVV4bEDGedwZHaj+j+S/PaaW 9K2IXGGRjNjyZBaPkrDPgZsBtLdpY+8V/Wg+RDTGrSzL+mT721SQhAyT1jwNjeQMbpj95PaE/hv Onz20JsBfDquih+zJ0YsvdmGHkYA4CnB31gBGOu2vUVBpcvIbqxNR4Iji8IpU92RmZw== X-Gm-Gg: ATEYQzxGerLlcWiu3dxa/A2rq95h28Lk/O5eXH/Fq1hRLTtAc+fdnyA5d6DMv1FcSd9 eMmF28G16SO2My9Vypcmbs6n6FyF+b6vjfu8tluvvrE+pzPoxefowx2rYGdsFIzWXkjig5oW++A Aa2SwWgMZihBhtm2MjzJTMOgbwldmaxK5xJ6P4qZR9XMqvxvW0qikxN2/m7V6WeVvbyDhhpwefa vFoiobZbm8ur3w1hfQKEmNlR+ZVRv+Osq2GpZjiZKa5WAm5ayFKMHMnziWmOGV72IZZ4P3/ftYU sJKr4vOanqAKtVbi+eW+nufGpSPEqVeKeL8dNYyq9Tz1jTNHWbccz7SExdeF3w3KOku2CTr5o+C xUF3EBHWgtRBdN1+rDg== X-Received: by 2002:a17:902:ccd2:b0:2b0:5682:6973 with SMTP id d9443c01a7336-2b08273d0d4mr101278535ad.19.1774254271397; Mon, 23 Mar 2026 01:24:31 -0700 (PDT) X-Received: by 2002:a17:902:ccd2:b0:2b0:5682:6973 with SMTP id d9443c01a7336-2b08273d0d4mr101278345ad.19.1774254270964; Mon, 23 Mar 2026 01:24:30 -0700 (PDT) Received: from redhat.com ([209.132.188.88]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b08365a62bsm136181655ad.46.2026.03.23.01.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2026 01:24:30 -0700 (PDT) Date: Mon, 23 Mar 2026 16:24:28 +0800 From: Li Wang To: Waiman Long Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Tejun Heo , Michal =?utf-8?Q?Koutn=C3=BD?= , Shuah Khan , Mike Rapoport , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Sean Christopherson , James Houghton , Sebastian Chlad , Guopeng Zhang , Li Wang Subject: Re: [PATCH v2 5/7] selftests: memcg: Reduce the expected swap.peak with larger page size Message-ID: References: <20260320204241.1613861-1-longman@redhat.com> <20260320204241.1613861-6-longman@redhat.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20260320204241.1613861-6-longman@redhat.com> On Fri, Mar 20, 2026 at 04:42:39PM -0400, Waiman Long wrote: > When running the test_memcg_swap_max_peak test which sets swap.max > to 30M on an arm64 system with 64k page size, the test failed as the > swap.peak could only reach up only to 27,328,512 bytes (about 25.45 > MB which is lower than the expected 29M) before the allocating task > got oom-killed. > > It is likely due to the fact that it takes longer to write out a larger > page to swap and hence a lower swap.peak is being reached. Setting > memory.high to 29M to throttle memory allocation when nearing memory.max > helps, but it still could only reach up to 29,032,448 bytes (about > 27.04M). As a result, we have to reduce the expected swap.peak with > larger page size. Now swap.peak is expected to reach only 27M with 64k > page, 29M with 4k page and 28M with 16k page. > > Signed-off-by: Waiman Long > --- > .../selftests/cgroup/test_memcontrol.c | 26 ++++++++++++++++--- > 1 file changed, 22 insertions(+), 4 deletions(-) > > diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c > index c078fc458def..3832ded1e47b 100644 > --- a/tools/testing/selftests/cgroup/test_memcontrol.c > +++ b/tools/testing/selftests/cgroup/test_memcontrol.c > @@ -1032,6 +1032,7 @@ static int test_memcg_swap_max_peak(const char *root) > char *memcg; > long max, peak; > struct stat ss; > + long swap_peak; > int swap_peak_fd = -1, mem_peak_fd = -1; > > /* any non-empty string resets */ > @@ -1119,6 +1120,23 @@ static int test_memcg_swap_max_peak(const char *root) > if (cg_write(memcg, "memory.max", "30M")) > goto cleanup; > > + /* > + * The swap.peak that can be reached will depend on the system page > + * size. With larger page size (e.g. 64k), it takes more time to write > + * the anonymous memory page to swap and so the peak reached will be > + * lower before the memory allocation process get oom-killed. One way > + * to allow the swap.peak to go higher is to throttle memory allocation > + * by setting memory.high to, say, 29M to give more time to swap out the > + * memory before oom-kill. This is still not enough for it to reach > + * 29M reachable with 4k page. So we still need to reduce the expected > + * swap.peak accordingly. > + */ > + swap_peak = (page_size == KB(4)) ? MB(29) : > + ((page_size <= KB(16)) ? MB(28) : MB(27)); Or, go with a dynamic adjustment based on page size? swap_peak = MB(29) - ilog2(page_size / KB(4)) * MB(1); -- Regards, Li Wang