From owner-freebsd-hackers@freebsd.org Wed May 22 00:37:18 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 124D61595A23 for ; Wed, 22 May 2019 00:37:18 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic301-20.consmr.mail.gq1.yahoo.com (sonic301-20.consmr.mail.gq1.yahoo.com [98.137.64.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B87088936F for ; Wed, 22 May 2019 00:37:16 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: 2PtxUicVM1lkNACrGOZ.X6hfXJ1GtVzaU4iwsvCnHwyW8B0enfIalhxLvBi10OC Gg3trixgsQCFCczT2fYvkWXWbtxPD2qztVpn.vcLED816SIG_YC0ClyQ57kYLcuZEPC23qXwe6eu k6yI.xOqQAugvlasq0xS9zS8R95vphFYRyFbUTGMoDXCxAZ5R1u.brrJvi9xbFZ9lj8Az0.qn3Wm tIZP.8UFIUu65pmu6hdRmAxGtEGwYXMZUVlHKJKfzd5ad5CPtvVBtQScYocqdtT9Cs9ARZiihzbu X.yvMA8n3yf8z67m2QqudSCP_zwDhDdTvzalRBdNs.AmWBg2CUaQb7VkYWtO89W0Q5TrWorMoWmF gwmEXVkGgRLU7x8xGcNvsNzYmnopmZtqELmM.F9XtSADsDO3H8BycnhEjUs7aKpaP3PVzMsF8MWh E9oq7RNXecHM2lSlfOsx0HDW6mE1cAczMxkNAW.0D3.l_U_zMGyV99SF0j8UUrjJfQPyuwh.2OcM DWYgb8noYsmId6Q64cFLDHkQ.zb3jHmmEIhxCmMo4S7kSIsIAbniwgVK4S4Im8qaeJ_BaT3yacUx ts.8uktArxmwh4p6m7G2hHDZCK2FVibmHFTcv2YBkR3Ajq10SecdqDLoY9d6uJ61_nOdiYU.PwIn faJI4JIoF1VcQb7igbHfwN4mFnlxLpNzhuyWFhe8y6T_zmAvzGB1kBMa1jaEgdYkUn2tIScabrKp cGdXPTx3GuIyAKqru9ppv5Yc5pn7O18tnTGRQmhaXPesWi6ezN5kiHEwQQQljdTx_.lUjHL6kIW1 tIzrWe9xdr8LADovrDFHF1100Mgn9ed5XuPcSlxM6o3F7iSalWfbHuniXvoekb3GRUO_6uZu7HQD n.OjLys3AYtYcB5DsfaN9BDuzKLkVyepKWHTmAhIoTeAC8zA9U7aFJzqgqZ76lwYTjZogLZviZRG 1neM4jxY0IjbALaCUAeUN70zVJyrRUGXBgj9J239JxOyHKmRcr7vZCRup5eQhf9SWud.SUVWEMqD CCilCu0rweYXvwNBpwhy3KWsJJbPq8jntmqLweZ_.a5W.RrYJSJt0dVdTBgnlhp8TnZiRFDRxTrP 7EPoxm1SMdNrSZWun8_fptN2WdFuUxnQh_jmWzLvODTXnT8mY4WuW06TIKoJS0Y8ufshKCmNljsX nFHv4DgBeFg84Gb4qe9z0_o9MbB4wmIiiZDo84PigLGusnnNReGhWIWISZWc- Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.gq1.yahoo.com with HTTP; Wed, 22 May 2019 00:37:06 +0000 Received: from c-76-115-7-162.hsd1.or.comcast.net (EHLO [192.168.1.103]) ([76.115.7.162]) by smtp425.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 4c3347dcd29deb12d32ea406e41bc0cc; Wed, 22 May 2019 00:37:04 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: total configured swap exceeds maximum From: Mark Millard In-Reply-To: <20190519174030.0206eb41@gumby.homeunix.com> Date: Tue, 21 May 2019 17:37:03 -0700 Cc: FreeBSD Hackers , Wojciech Puchar Content-Transfer-Encoding: quoted-printable Message-Id: <47795095-3575-4648-93F0-9C9CAFAB1D47@yahoo.com> References: <20190519160033.0b0e47fa@gumby.homeunix.com> <18598E43-CFB1-4C3C-BC46-A4F0DEB569CF@yahoo.com> <20190519174030.0206eb41@gumby.homeunix.com> To: RW X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: B87088936F X-Spamd-Bar: ++ X-Spamd-Result: default: False [2.70 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; MV_CASE(0.50)[]; FREEMAIL_FROM(0.00)[yahoo.com]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; MX_GOOD(-0.01)[cached: mta6.am0.yahoodns.net]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; FREEMAIL_TO(0.00)[googlemail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; SUBJECT_ENDS_SPACES(0.50)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; NEURAL_HAM_MEDIUM(-0.28)[-0.285,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.81)[0.809,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(1.77)[ip: (7.10), ipnet: 98.137.64.0/21(1.00), asn: 36647(0.80), country: US(-0.06)]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.42)[0.419,0]; RCVD_IN_DNSWL_NONE(0.00)[146.64.137.98.list.dnswl.org : 127.0.5.0] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 00:37:18 -0000 On 2019-May-19, at 09:40, RW via freebsd-hackers wrote: > On Sun, 19 May 2019 08:53:15 -0700 > Mark Millard wrote: >=20 >> On 2019-May-19, at 08:33, Wojciech Puchar wrote: >>=20 >>>>> what should i set kern.maxswzone to ? it is 0 >>>>>=20 >>>>> # sysctl kern.maxswzone >>>>> kern.maxswzone: 0 =20 >>>>=20 >>>> IIRC for amd64 kern.maxswzone=3D0 represents the maximum allowed. =20= >>> so i cannot have more VM than 5*RAM? =20 >>=20 >> There is is a kernel memory tradeoff structure to increase in >> kern.maxswzone being larger as I understand. Quoting "man 8 loader" >> (but the "eight times" is system/architecture specific and will >> likely be different): >>=20 >> kern.maxswzone >> Limits the amount of KVM to be used to hold swap >> metadata, which directly governs the maximum amount of swap the >> system can support, at the rate of approximately 200 >> MB of swap space per 1 MB of metadata. This value is specified >> in bytes of KVA space. If no value is provided, the >> system allocates enough memory to handle an amount of swap that >> corresponds to eight times the amount of physical >> memory present in the system. >=20 > In swap_pager.c >=20 > /* > * Initialize our zone, guessing on the number we need based > * on the number of pages in the system. > */ > n =3D vm_cnt.v_page_count / 2; > if (maxswzone && n > maxswzone / sizeof(struct swblk)) > n =3D maxswzone / sizeof(struct swblk); >=20 > In i386 maxswzone defaults to a specific value and it is possible to > increase the size. In amd64 maxswzone defaults to 0 which give the > highest value of n permitted. The code that you quoted is old in head/ and stable/12/ and stable/11/ (but has not been updated in release/12.0.0/ or in release/11.2.0/ ): /[base]/head/sys/vm/swap_pager.c Revision 341375 - (view) (download) (annotate) - [select for diffs]=20 Modified Sat Dec 1 16:50:12 2018 UTC (5 months, 2 weeks ago) by kib=20 File length: 75712 byte(s)=20 Diff to previous 340637 Allow to create swap zone larger than v_page_count / 2. If user configured the maxswapzone tunable, just take the literal value for the initial zone sizing attempt. Before, it was only possible to reduce the zone by the tunable. While there, correct the message which was not correct when zone creation rounded the size up. Reported by: jmg Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential revision:=09 https://reviews.freebsd.org/D18381 /[base]/stable/12/sys/vm/swap_pager.c Revision 341716 - (view) (download) (annotate) - [select for diffs]=20 Modified Sat Dec 8 00:46:05 2018 UTC (5 months, 1 week ago) by kib=20 File length: 75745 byte(s)=20 Diff to previous 340333 MFC r341375 : Allow to create swap zone larger than v_page_count / 2. /[base]/stable/11/sys/vm/swap_pager.c Revision 341718 - (view) (download) (annotate) - [select for diffs]=20 Modified Sat Dec 8 00:48:10 2018 UTC (5 months, 1 week ago) by kib=20 File length: 73330 byte(s)=20 Diff to previous 335508 MFC r341375 : Allow to create swap zone larger than v_page_count / 2. The new code looks like: /* * Initialize our zone, taking the user's requested size or * estimating the number we need based on the number of pages * in the system. */ n =3D maxswzone !=3D 0 ? maxswzone / sizeof(struct swblk) : vm_cnt.v_page_count / 2; =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)