Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3882852imu; Mon, 28 Jan 2019 12:36:44 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Yt4t5L+c8lXHzKHD2C2Coc8H6Fr8MiMmHFQhBob1hFw/3esC2/AxCIw4G6ulcpA90Kthx X-Received: by 2002:a62:4e83:: with SMTP id c125mr23586235pfb.101.1548707804361; Mon, 28 Jan 2019 12:36:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548707804; cv=none; d=google.com; s=arc-20160816; b=YxsSnSBidSLB+2on7lQFrHwJRdre00JcxwQ3KRK1uWTjWqHMAdULSsAjGIY90Du2/p smXHtN85NOzcf/ZSjQQVMKAXMAVOIW84l4Vowzf+0XLZ1ArehTPS9E4E+g8uy1IxTSFy tZy5KL1jxkRvTa0v1ti1IZfGB7xnXhOYjAfKMV/2hJnxSyTbM/tQcfwVQ5eD/syUkekL z8SEdXlZEYnwPfLMUAzZBEFKFuZYmqja3cNiCYJwqLzHo7wGTSWJM6k7UCbLCvd/5RG0 j39e5rXOjOjiGKg0retWSWgM5g8jZWYG7szYr9UQ3hrj/KiYPJiRDqkCDiWxx8OE1bIc txJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to:date :cc:to:from:subject:message-id; bh=ymGdMmjQsq0XrO1Q3yzxu1Anx6UPObBX8MzxqmY6+9A=; b=Em/vGp6xkaZfIGahFArOxhVKSbCfPdRGayo8EEYn4erKm39aosBgNNzLkAncNQN4U0 OKqxq3ZkeM7bVxxWtUb3n/b7RtdeiIT/4eW8enUQx5qNdur7oAtvt9Xz6lv8i+YD0nin ZHGMoXrPHpBd8cFm0Yujb6fa1NbDObifH3lxT4A69pSqUAX6CgB+z8c3dgsqdCmY7xN7 ISOoz8unUlhluSdUXHS/j5Gce4OCplJCv/a4WUnx+T/gLyfEu1kFxEc2ytS/r/riuJ+J WUGBr+7tdmFCPDWftOkLfwjD5qfTQr13in1yq597HsXE+1cdEL8XinUC4mdYt7oSDMHN FHNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si33762003pgl.108.2019.01.28.12.36.28; Mon, 28 Jan 2019 12:36:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727757AbfA1UeH (ORCPT + 99 others); Mon, 28 Jan 2019 15:34:07 -0500 Received: from shelob.surriel.com ([96.67.55.147]:43018 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726719AbfA1UeH (ORCPT ); Mon, 28 Jan 2019 15:34:07 -0500 Received: from imladris.surriel.com ([96.67.55.152]) by shelob.surriel.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1goDbX-0007BA-AU; Mon, 28 Jan 2019 15:34:03 -0500 Message-ID: Subject: Re: [PATCH] mm,slab,vmscan: accumulate gradual pressure on small slabs From: Rik van Riel To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-team@fb.com, Johannes Weiner , Chris Mason , Roman Gushchin , Michal Hocko Date: Mon, 28 Jan 2019 15:34:03 -0500 In-Reply-To: <20190128121028.8ef4c19dd3fd1d60d2e3284c@linux-foundation.org> References: <20190128143535.7767c397@imladris.surriel.com> <20190128115424.df3f4647023e9e43e75afe67@linux-foundation.org> <8ddf2ea674711f373062f4e056dd14fb81c5a2fe.camel@surriel.com> <20190128121028.8ef4c19dd3fd1d60d2e3284c@linux-foundation.org> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-rjs2+VELR5ryBMzF0Fbr" X-Mailer: Evolution 3.28.5 (3.28.5-1.fc28) Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-rjs2+VELR5ryBMzF0Fbr Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2019-01-28 at 12:10 -0800, Andrew Morton wrote: > On Mon, 28 Jan 2019 15:03:28 -0500 Rik van Riel > wrote: >=20 > > On Mon, 2019-01-28 at 11:54 -0800, Andrew Morton wrote: > > > On Mon, 28 Jan 2019 14:35:35 -0500 Rik van Riel > > > > > > wrote: > > >=20 > > > > memory. > > > > */ > > > > - delta =3D max_t(unsigned long long, delta, min(freeable, > > > > batch_size)); > > > > + if (!delta) { > > > > + shrinker->small_scan +=3D freeable; > > > > + > > > > + delta =3D shrinker->small_scan >> priority; > > > > + shrinker->small_scan -=3D delta << priority; When delta is a non-zero number, we subtract (delta << priority) from shrinker->small_scan. That should happen every time delta >=3D (1< > > > + > > > > + delta *=3D 4; > > > > + do_div(delta, shrinker->seeks); > > >=20 > > > What prevents shrinker->small_scan from over- or underflowing > > > over > > > time? > >=20 > > We only go into this code path if > > delta >> DEF_PRIORITY is zero. > >=20 > > That is, freeable is smaller than 4096. > >=20 >=20 > I'm still not understanding. If `freeable' always has a value of > (say) > 1, we'll eventually overflow shrinker->small_scan? Or at least, it's > unobvious why this cannot happen. --=20 All Rights Reversed. --=-rjs2+VELR5ryBMzF0Fbr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAlxPZzsACgkQznnekoTE 3oOmVwf/Y6GZfr1jizlPlmJ8N8/biC88i2jgOJ0lcwGiQayXBu5E3OdH66QhVzi8 RfXbwYurPgoS27JZUmDc1aRuxj6Ueb6YyeJ3pAM4G4pa4TVTM/yoTp9h1JVGFiGK +82nTKdbHtiRabzwGoE0bHx/DriKGNEKzHEus6ikrj2SSCa7rFJ//3MEIBKnVoT/ ua3diiob0opvUrVD1oU+Qr87yQtG/Fh4CgS4CF+oTCsZspNsRTXknqWHVyF7S0W6 i/LasJK4iTZ5toDtTcBeqYJS9VpbEK1UiAw6LSzJoE+Js2Qkr4CX3euBe6fvszdd XJ0O8eEdqfG/oDytFji+LSmEeRu0sQ== =VeYE -----END PGP SIGNATURE----- --=-rjs2+VELR5ryBMzF0Fbr--