Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp757361yba; Fri, 12 Apr 2019 13:08:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwKUc/OGUd98+PvxCusTnBxu9bW0L2mplO73NGqDCsVpofvGjrm9DFzR/dO9RsERtpIK/m X-Received: by 2002:a63:78ce:: with SMTP id t197mr55658155pgc.314.1555099706644; Fri, 12 Apr 2019 13:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555099706; cv=none; d=google.com; s=arc-20160816; b=B+S14T5wOLjEtrJIUVk9rZoiiqaS3YHW/X9gglPPffN5JAxXW2urALfxhqleNh9BJy oQKAWrhxxLxCvwHHjMSkF73vroSR4JXwayphWTGCG4FfuTpCAca9O5IZtI6A6EKolXcr Pibh3pMqwHtbJ5/OqlRlqHWJk+vMdoHtWIXkQzwoXPeMo55dniIlnmVNplWai+rpe2Md EXMUUDz1foa2Wgh08kKim/5n4gmJ/8zNngfbakjoUGDtMgdORXzvW7uflLllqI8AlKt8 N29hIsTrJH3/ygcgexfn/cfr6VzlXEZkI0xRaRg1iavNJK52xknJdwJHZRIQVT/EZ9vW 4U8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature:dkim-signature; bh=w34ue0TCLhcYpA27Lg6nzR6yawZCjemc0AF2Iua7eSc=; b=m0HTGmYy4gcnK206jgwjF+FY02ZImPbayYig11fc1zwox1FEdEMj5wNrnR54Bk8Ehs 8n1jGrmN0tRgu6zBo60bOPmIthZJbVShOz1uouo6+UaTPRgTp6PYqy4En11lrE7oVWZF fkyAKIhETlRBIwLVWFUkgcv0bf31CnIOfaeYoOHGJo6MQwnG087WtgxtzWrsfGXBWGtv aEeWo5+28w49/Xl25VoYlatvHpmGNzIFSq7gFayKv3ac1ECJDDxA2kzNWKJ35wpKMAbe EQTmD2AWnxoi/MGS4PAo3w0QfoZpIQVNz6PXki+xyDC+PqW6FKX7IbAdeutCv8mpfVdh MSFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=OthroVqi; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b="Ld+kq/Xk"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4si24016884pgs.215.2019.04.12.13.08.06; Fri, 12 Apr 2019 13:08:26 -0700 (PDT) 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; dkim=pass header.i=@fb.com header.s=facebook header.b=OthroVqi; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b="Ld+kq/Xk"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726898AbfDLUHH (ORCPT + 99 others); Fri, 12 Apr 2019 16:07:07 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:40964 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726771AbfDLUHG (ORCPT ); Fri, 12 Apr 2019 16:07:06 -0400 Received: from pps.filterd (m0044008.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3CK4fO3030123; Fri, 12 Apr 2019 13:06:58 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=facebook; bh=w34ue0TCLhcYpA27Lg6nzR6yawZCjemc0AF2Iua7eSc=; b=OthroVqixESb+voiTgT+rRwz2z7bj5BNfFMIO2/xMNVkVWLv+mKfkzUBouvv90TalpsN sbpQNL6y56qGAdw/CRJuU7tTJN/TZDYWHfFSORUXpR4n9AUfle2/KJjQH9LnfI5+XF/U ifpgWi1K1S9vQ3ChY43t6MdhrHhdgvMW564= Received: from mail.thefacebook.com (mailout.thefacebook.com [199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2rtw0wrxg6-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 12 Apr 2019 13:06:58 -0700 Received: from prn-mbx07.TheFacebook.com (2620:10d:c081:6::21) by prn-hub04.TheFacebook.com (2620:10d:c081:35::128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.1713.5; Fri, 12 Apr 2019 13:06:56 -0700 Received: from prn-hub02.TheFacebook.com (2620:10d:c081:35::126) by prn-mbx07.TheFacebook.com (2620:10d:c081:6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.1713.5; Fri, 12 Apr 2019 13:06:55 -0700 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.1713.5 via Frontend Transport; Fri, 12 Apr 2019 13:06:55 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w34ue0TCLhcYpA27Lg6nzR6yawZCjemc0AF2Iua7eSc=; b=Ld+kq/XkF7mybhf8LhRGO1LH0MlPBJuffsxGDYoPBPbxom7sQaAkpdxHzIAYpe+pRPpCHrM+VDgcs52scN3rK3ZDQk89KLH7n2qPyJlUIimGXko5hYyxangmYD7eS4wOESVT9ACxs3ZQAqJzC8QKPlMg17v1k4KbqbE3NhBhkiw= Received: from BYAPR15MB2631.namprd15.prod.outlook.com (20.179.156.24) by BYAPR15MB3464.namprd15.prod.outlook.com (20.179.60.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.17; Fri, 12 Apr 2019 20:06:34 +0000 Received: from BYAPR15MB2631.namprd15.prod.outlook.com ([fe80::d1a1:d74:852:a21e]) by BYAPR15MB2631.namprd15.prod.outlook.com ([fe80::d1a1:d74:852:a21e%5]) with mapi id 15.20.1792.016; Fri, 12 Apr 2019 20:06:34 +0000 From: Roman Gushchin To: Johannes Weiner CC: Andrew Morton , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Kernel Team Subject: Re: [PATCH] mm: fix false-positive OVERCOMMIT_GUESS failures Thread-Topic: [PATCH] mm: fix false-positive OVERCOMMIT_GUESS failures Thread-Index: AQHU8WPzV7whvXpmeUeLhsl6IRCndKY486cA Date: Fri, 12 Apr 2019 20:06:34 +0000 Message-ID: <20190412200629.GA24377@tower.DHCP.thefacebook.com> References: <20190412191418.26333-1-hannes@cmpxchg.org> In-Reply-To: <20190412191418.26333-1-hannes@cmpxchg.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MWHPR10CA0060.namprd10.prod.outlook.com (2603:10b6:300:2c::22) To BYAPR15MB2631.namprd15.prod.outlook.com (2603:10b6:a03:152::24) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2620:10d:c090:200::1:2586] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 618b90be-36fd-4858-de96-08d6bf825c63 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(2017052603328)(7193020);SRVR:BYAPR15MB3464; x-ms-traffictypediagnostic: BYAPR15MB3464: x-microsoft-antispam-prvs: x-forefront-prvs: 0005B05917 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(346002)(396003)(366004)(39860400002)(136003)(199004)(189003)(76176011)(476003)(11346002)(33656002)(81156014)(81166006)(486006)(478600001)(446003)(68736007)(229853002)(8936002)(6436002)(102836004)(6512007)(5660300002)(1076003)(6116002)(54906003)(316002)(4326008)(14454004)(256004)(7736002)(71190400001)(2906002)(71200400001)(6506007)(386003)(305945005)(9686003)(6916009)(86362001)(25786009)(6486002)(14444005)(106356001)(105586002)(6246003)(99286004)(186003)(97736004)(53936002)(52116002)(8676002)(46003);DIR:OUT;SFP:1102;SCL:1;SRVR:BYAPR15MB3464;H:BYAPR15MB2631.namprd15.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: fb.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: a2FLjq9PZzm9RXIQb4/s5oW76KDP6WrSHcN+R/HqE1rdkyXjmhAOBLvBaAOfW/iStb+8udrALGRjiqLWleAdAJcFE2X15zykVg2CQmQ/STrbbPXEFMBJxtanOre2uRID6En4FmqFQUAriQwrca8ahwGOohONKxxhCoopzU7xosBceSRLn1j66biTVRdULoHQZCoCdmR8C4LyTVGF9YaLySnMINLcbxMHgEZUzd8Ko3Lk3/Tr03r3BhSa8HeY3PryaopYaWno5Ori5BglrEmcAgGORdhHw/To9CK6Lw7lNVJJb+0JQkpTYB+IhvnjO4FSOYwfIg5DrwpbAwyZvXzi5iGCcDK16TJ6FvAbKH6c0Ax/cMnwaiviKw9SaOTvYwv/KHMkt5YZbkf4V8wzoBuF3ZGTZBrrjLEGNx4qCEHDzqo= Content-Type: text/plain; charset="us-ascii" Content-ID: <07E8811B2E537E488E0FA5B519045F3F@namprd15.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 618b90be-36fd-4858-de96-08d6bf825c63 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2019 20:06:34.1190 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR15MB3464 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-04-12_11:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 12, 2019 at 03:14:18PM -0400, Johannes Weiner wrote: > With the default overcommit=3D=3Dguess we occasionally run into mmap > rejections despite plenty of memory that would get dropped under > pressure but just isn't accounted reclaimable. One example of this is > dying cgroups pinned by some page cache. A previous case was auxiliary > path name memory associated with dentries; we have since annotated > those allocations to avoid overcommit failures (see d79f7aa496fc ("mm: > treat indirectly reclaimable memory as free in overcommit logic")). >=20 > But trying to classify all allocated memory reliably as reclaimable > and unreclaimable is a bit of a fool's errand. There could be a myriad > of dependencies that constantly change with kernel versions. >=20 > It becomes even more questionable of an effort when considering how > this estimate of available memory is used: it's not compared to the > system-wide allocated virtual memory in any way. It's not even > compared to the allocating process's address space. It's compared to > the single allocation request at hand! >=20 > So we have an elaborate left-hand side of the equation that tries to > assess the exact breathing room the system has available down to a > page - and then compare it to an isolated allocation request with no > additional context. We could fail an allocation of N bytes, but for > two allocations of N/2 bytes we'd do this elaborate dance twice in a > row and then still let N bytes of virtual memory through. This doesn't > make a whole lot of sense. >=20 > Let's take a step back and look at the actual goal of the > heuristic. From the documentation: >=20 > Heuristic overcommit handling. Obvious overcommits of address > space are refused. Used for a typical system. It ensures a > seriously wild allocation fails while allowing overcommit to > reduce swap usage. root is allowed to allocate slightly more > memory in this mode. This is the default. >=20 > If all we want to do is catch clearly bogus allocation requests > irrespective of the general virtual memory situation, the physical > memory counter-part doesn't need to be that complicated, either. >=20 > When in GUESS mode, catch wild allocations by comparing their request > size to total amount of ram and swap in the system. >=20 > Signed-off-by: Johannes Weiner My 2c here: any kinds of percpu counters and percpu data is accounted as unreclaimable and can alter the calculation significantly. This is a special problem on hosts, which were idle for some time. Without any memory pressure, kernel caches do occupy most of the memory, so than a following attempt to start a workload fails. With a big pleasure: Acked-by: Roman Gushchin Thanks!