Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4933296ybp; Mon, 7 Oct 2019 16:39:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwc/qjBUCFJ67GMmzhHQKJUiUlWPXFuUMfueOqbwIMy/kIvnx2pslJCmKeUMD8cFz86T7Du X-Received: by 2002:a17:906:b74e:: with SMTP id fx14mr25551520ejb.226.1570491567383; Mon, 07 Oct 2019 16:39:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1570491567; cv=pass; d=google.com; s=arc-20160816; b=SjkYKTkcycFyXa8Fvu6/WFGkxkGWY860EcS3nW0rS6x1zxQU7h75NZzXe3OXpaddb9 R7IN7rUEq3bDzey8RUongAmGLYFaHtq3/gDQHmAJb28I6ACgDKTqPQtnUCQay9v5Kyt6 IHPJyInfevLcUY4od87Q102hFU4bRTtMWYD6dNo7s43tVpp9Opt84PtvUihlqT1xqmga zZ0ejysKKP7sVzh3jFbTGg8teWzLJl2wJZMRNrbpYP8+53jwQUi7ZFjN4XLnjiFJTZoJ T8thAf+7No+yerHBwtQ90wb6vAoh0dAQIoROxSK5NGLiI4D0JjOHjS+/YXQfsHvSiYy0 +oKg== ARC-Message-Signature: i=2; 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=pZW78zJWzn/iSK9kZrAtn/ngmP50RhTvGj73mHVCs6Q=; b=Eqz7xNu3GdC1phgHphM3mXRnclzqkjim1+FUeu9Cq8ulS1QvygeY/GMCK2yeM+amxy 1V6af+SaMH/3N0scg97IJgc/n/+vfwZknQ87KAwXvF+InoJyS2II9yhyqvHMCRVbUdbh HLWajeVrqlnfFOMhKsIH7KIrQdPa8bT00FvFef81EdRLKwtkMON4BD8tm2QYS3vpLr3D MNQU2o5TDayx/uZJHnXW2O837WwKxKR6rOTsjZReGP1Ka7mcM7D3qEzrtny4/EJxgF4n EJQrnzS1qTS+12Bs4C6WB0TISX+jgpGd0IjHWG9IRl3cIhxqwBAy0ULU2yQW1R2eEYcD Qs5A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=kno4fMwH; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector2-fb-onmicrosoft-com header.b=bWg+JDvr; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.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; 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 k23si9553940ede.274.2019.10.07.16.39.02; Mon, 07 Oct 2019 16:39:27 -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=kno4fMwH; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector2-fb-onmicrosoft-com header.b=bWg+JDvr; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729703AbfJGXgL (ORCPT + 99 others); Mon, 7 Oct 2019 19:36:11 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:37936 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729145AbfJGXgK (ORCPT ); Mon, 7 Oct 2019 19:36:10 -0400 Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.16.0.42/8.16.0.42) with SMTP id x97NYAS9030409; Mon, 7 Oct 2019 16:36:03 -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=pZW78zJWzn/iSK9kZrAtn/ngmP50RhTvGj73mHVCs6Q=; b=kno4fMwH1yAf5RDnvc/FNo4jqvAqLiWQTcRvmd8/jr2A5dfE5J9eF7br0lcm9auILKAR 0PO37WBDE5wNmOKK1K4nW6QoOAFHiLfkw2zD8ArCDn7XXehu8kc8auzazTRU4tNnttIZ TTLLUMEO3ABi1bOs+fj3+ZzVVmADh2//9jc= Received: from maileast.thefacebook.com ([163.114.130.16]) by m0089730.ppops.net with ESMTP id 2vepp1tqtu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 07 Oct 2019 16:36:03 -0700 Received: from ash-exhub103.TheFacebook.com (2620:10d:c0a8:82::c) by ash-exhub104.TheFacebook.com (2620:10d:c0a8:82::d) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 7 Oct 2019 16:36:02 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (100.104.31.183) by o365-in.thefacebook.com (100.104.35.174) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 7 Oct 2019 16:36:02 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kby1g/BFLAe5ddMXnYIun9eH1Qe/t91H1Ebf7zuA0ULc05klWmkEFgyeFPF3Jreueym3RnpHaP+ieV/zB46gF99RBTLV5wcCg3VGe5p8bU5L2tPm1iqldg8RTW9zqM7mODLld5wbvrKaUg4gYSCActBbAphss89dsYTPLS6/vZkIXNI7KWNS9q+T2HUeguU9BwU5Ykup8aV8zzt7tdL9X1Q0xh5pcQW5gFaw570AdIT38Pn3J+80UZZ484uvfFG/I5mCwKQD6y1Tv7nmZc1t56NyP6Ed2xxGV16ut7V6h2pHGC7wsdigQ4vQEyiOVK/489MNMXj4HzTyW128tdf3EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pZW78zJWzn/iSK9kZrAtn/ngmP50RhTvGj73mHVCs6Q=; b=liO+owMxDEWxspcKasT7kgYnl4xBlTRRf+t1QarqSn6IfBsBST8mK56+WC/L1TejDEpYvgaHeMj63FZbwhKy+GCxJoiXnD+Q3jscqrIQD49qmLCBxuuUomllh3n6ArJvKmRJWzFB0JJCM0jmHwiZpQeiaAf6eFiBQgLiP47zu3VyUQ6kyosAA8IYE0U3zKI0HAVP/9tYtP9o2AmPod2VYfM5bju+ZOxpCtMomoZmYMtw3GtpKYOFX5qly+qfu7wiBy9nNZXkjDI55y8R9nqHD2d+oHmY9blT0t7NXLArGNYL51PK7W+Btf8xluQouZUThOkj6ukd11zf6PIlX3zSvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fb.com; dmarc=pass action=none header.from=fb.com; dkim=pass header.d=fb.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector2-fb-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pZW78zJWzn/iSK9kZrAtn/ngmP50RhTvGj73mHVCs6Q=; b=bWg+JDvrARuZavR+rs/l3bbpFs57XXeVO8qorn/1RvIwiIGhcOI2/HxvNJCtZoDhVboe4Lm9tYMC0isjQIj3/fYIydi6ZeZ2640ij9EmmjC1qV8icV1B/Fp4cLizbSyaIIAxJyXIYsWccNB3l+u+lZZYtwT66uu8Sfldf4QM9Ak= Received: from BN8PR15MB2626.namprd15.prod.outlook.com (20.179.137.220) by BN8PR15MB2946.namprd15.prod.outlook.com (20.178.218.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2327.25; Mon, 7 Oct 2019 23:35:44 +0000 Received: from BN8PR15MB2626.namprd15.prod.outlook.com ([fe80::dde5:821f:4571:dea4]) by BN8PR15MB2626.namprd15.prod.outlook.com ([fe80::dde5:821f:4571:dea4%5]) with mapi id 15.20.2327.026; Mon, 7 Oct 2019 23:35:44 +0000 From: Roman Gushchin To: Vlastimil Babka CC: "linux-mm@kvack.org" , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Kernel Team , "tj@kernel.org" , Jan Kara Subject: Re: [PATCH] cgroup, blkcg: prevent dirty inodes to pin dying memory cgroups Thread-Topic: [PATCH] cgroup, blkcg: prevent dirty inodes to pin dying memory cgroups Thread-Index: AQHVewChQOAw+GKbfEyRn45Yoe7HH6dPSQKAgACQ1oA= Date: Mon, 7 Oct 2019 23:35:43 +0000 Message-ID: <20191007233539.GC11171@tower.DHCP.thefacebook.com> References: <20191004221104.646711-1-guro@fb.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MWHPR2201CA0037.namprd22.prod.outlook.com (2603:10b6:301:16::11) To BN8PR15MB2626.namprd15.prod.outlook.com (2603:10b6:408:c7::28) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2620:10d:c090:200::3:2a00] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5d2cbed6-d647-4fb5-b010-08d74b7f1250 x-ms-traffictypediagnostic: BN8PR15MB2946: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 01834E39B7 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(136003)(396003)(39860400002)(366004)(376002)(346002)(199004)(189003)(54094003)(386003)(316002)(6506007)(6916009)(54906003)(486006)(53546011)(52116002)(76176011)(476003)(11346002)(446003)(46003)(102836004)(2906002)(71200400001)(71190400001)(6116002)(86362001)(186003)(66446008)(66946007)(66476007)(66556008)(64756008)(6436002)(9686003)(6512007)(6486002)(229853002)(7736002)(305945005)(4326008)(14444005)(99286004)(8936002)(81166006)(8676002)(81156014)(256004)(1076003)(14454004)(5660300002)(25786009)(478600001)(33656002)(6246003)(14143004);DIR:OUT;SFP:1102;SCL:1;SRVR:BN8PR15MB2946;H:BN8PR15MB2626.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: BCL:0; x-microsoft-antispam-message-info: BXXuIp7lriX5zSLgXXbzpcyC+DyrNOy6uUA7y3Bxtkt919JA4nLhmKLujIZbUOSPFv59R4Q5yUOI699UNP4v7DsmJCSvKI3WDEGAWJKKJQ6CZ3yxPmKu/BCm8GamlEZ7efswIUPv1q8BB+0hoagbdSRUXAaxm4cpFg5moKAD2/IbGKGmBKkKKMw8kkR/Tr3KX6MUHvsfKQr+RjEOPrUBJBhJ4UeL4gvNOsU1yBSs11oMMsklwR2i59YIMnhWED6S+Fg5I0VRlkTT3u/5BL4XrwxakCR4nGHZvEVyWhk563S48Kcf1AZn2M4r0jd0RO4kYGsOG5g1T6d2R7NIhvMtcVGjBZMIySNLbKMPuxXYCaNOc/DUac2Do0lnH8+ADAQ+VH76e4Ed8sedYM6OulaNgK8thHC4bMBifnJwfSThoiY= Content-Type: text/plain; charset="us-ascii" Content-ID: <28F922B8B34A0C4D9800A6E1552519F0@namprd15.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 5d2cbed6-d647-4fb5-b010-08d74b7f1250 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Oct 2019 23:35:43.8510 (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-CrossTenant-userprincipalname: 13nwpEN+ppN9SedQGJJs5e7YZ7I498aeKap2yYnXFb/RvFW/1EzcgH4k4jm870Hu X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR15MB2946 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-07_04:2019-10-07,2019-10-07 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 malwarescore=0 clxscore=1015 suspectscore=0 bulkscore=0 adultscore=0 mlxlogscore=883 lowpriorityscore=0 spamscore=0 mlxscore=0 phishscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1910070211 X-FB-Internal: deliver Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 07, 2019 at 04:57:15PM +0200, Vlastimil Babka wrote: > On 10/5/19 12:11 AM, Roman Gushchin wrote: > > > > One possible approach to this problem is to switch inodes associated > > with dying wbs to the root wb. Switching is a best effort operation > > which can fail silently, so unfortunately we can't run once over a > > list of associated inodes (even if we'd have such a list). So we > > really have to scan all inodes. > >=20 > > In the proposed patch I schedule a work on each memory cgroup > > deletion, which is probably too often. Alternatively, we can do it > > periodically under some conditions (e.g. the number of dying memory > > cgroups is larger than X). So it's basically a gc run. > >=20 > > I wonder if there are any better ideas? >=20 > I don't know this area, so this will be likely easily shown impossible, > but perhaps it's useful to do that explicitly. >=20 > What if instead of reparenting each inode, we "reparent" the wb? It seems to be an arguable idea, at least at the offlining moment. Dirty memory left after a cgroup should be written back using corresponding limits, and reparenting can easily break them. Also, it's not clear to me, how to reparent dirty stats? > But I see it's not a small object either. Could we then add some bias > for inode switching conditions so that anyone else touching the inode > from dead wb would get it immediately? You mean touching for writing? That's doable, but doesn't solve the case when there are only readers. And the case is quite common. > And what would happen if we reused the reparented wb's for newly created > cgroups? Would it "punish" them for the old inodes? >=20 No idea, to be honest. Thank you!