Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2435323ioo; Sat, 28 May 2022 13:35:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRr6dnf/hupn+vdETMQzXxji29N6NxsAIB9L1Pn6/dppi7LaelZJXLL1gAQmCt+8CkjGaU X-Received: by 2002:a17:903:22c7:b0:161:cf2e:2ce2 with SMTP id y7-20020a17090322c700b00161cf2e2ce2mr49134165plg.59.1653770131384; Sat, 28 May 2022 13:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653770131; cv=none; d=google.com; s=arc-20160816; b=wG5B+mqw9+cZssNCrRJnT2FGcIDJMwDwaDI6jpq+l4Dx2PazwFO4e3hEfBOTlVPBSp RIJVe7NugrH77UGh+lm6dECf6GxwKAO/NHNU4qc0b4v0VbvNkK73/W2+OoU39Kj7JqTf X/r8RauelHx2Ns3W2nIUHF3hzZP23GvmMibNo1ZBBCy+xaAykVP+JMwurXQJUkz9MZD7 59No7F+tP6PpD666devDCxiE2sp4i0YuQr1Ga9EKGsf3NacYAerTlv2dTN3/QA5mNez+ 7D1M7itkZHvqGNN+CUTwkaAVDH2sB8Y6Zcrnddv2N5up98E0WezkqNXBGXHEkBQbqjt9 N52A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=M9FMFJI/J357AWjNf6HATXScadCdwguWFNkt78waWBM=; b=rBMsLf7MI0BW9Ji0RHXnydpgtKH9kKTUuhf0C0wT3J5jNXxtVijfahg6YbhuxA+lFD Z8P850cN6lrNlxTsRgOquS68gwhvGaTtuRISYzvrszERCZtug13oaXhOVEfZleNheuaS PxTs2uOLQOkFANYf0uLy41mXxec8m3eeBYgM7ydkT4qDmv6ibFBFQ+XESJF0cbibzwvg ZYX35ngPjKn1sLSk0BMrtgiZ2BqzcG+1F2W4J4y5h3JUcu35F2dEnjKX+hWntwa1VsQs BfB4scAQsLG3WWYljab5WybhcEv5b3rNDminjbjcl7qRrvCw544IDYAYabNKuoP+XC4m 21Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=jszfjOQN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id iz9-20020a170902ef8900b001562e0ba125si792702plb.504.2022.05.28.13.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:35:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=jszfjOQN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 671461A40BD; Sat, 28 May 2022 12:37:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347143AbiE0LW2 (ORCPT + 99 others); Fri, 27 May 2022 07:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241686AbiE0LWY (ORCPT ); Fri, 27 May 2022 07:22:24 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C9864D603 for ; Fri, 27 May 2022 04:22:23 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id l30so1300559lfj.3 for ; Fri, 27 May 2022 04:22:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz-org.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=M9FMFJI/J357AWjNf6HATXScadCdwguWFNkt78waWBM=; b=jszfjOQNBQQfrZfE+0swQ56OEuaHDyAFud8w34hVHZ4i2a96xQYsNynHMPG3M9WCuc XVSVrO8jxlh9H2s8cH8A7faJbQvBhS7XPpObKbIpBzA2dQc7yoFGid5yp9+BkT8BucBc TuHu3H4LtY/YvjxlrO+mUNrIUZGauALFsbTdiZta86lN+HJkhNQGwe6TXURRyUzOLo8U CRpuBgSEgKdvndEVNZktniGlwUIvnAEBCsvi+FYDPJ99aHMt24PNfTpDJlbKx8PVXj2V P9eOIDmmFVYy14CeIGoIS5f+dABhHFLXdMXDC3+LSEHgZjk0YUnk6QVpcB1Y2T7kHDxF 74rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=M9FMFJI/J357AWjNf6HATXScadCdwguWFNkt78waWBM=; b=56P4Tu6WhT0v2jQg30/ygCw59REe5SxfjeGBvb2OCFvOxo8d8JePzB3QLbAeCQnR00 LndUNrvso5X2k5iHyBBTcZo5/UsLHbBYI9f7LSIitD1OzKpovc/0QLQK7Bk7nuX+hUgF Jf0qw0RtYHaGQEOY2h6VrJjVwE7KCJpiydQs5FI0014DiBeFtCdiIXpQ1UuzvoEnLFny xWXgjSviumzS5BYWNDTAAWsARekniEqCPpdo7t89928+hfvSR8gxWAqQ5iRDWLRxLt7g l8isu1Yn3fno+nDDJCXF9flRWCuIXySAUrU90cAJB2D9gZ3t9tm4q9yqdfy0MWz5iQhl fRAw== X-Gm-Message-State: AOAM533pA08oluwqNzRcCAVl/a+PP1DDVyEsmP75mJeOCMc71N4DqZZ0 cFvzXNoLQm/NAyNUAQ0HtrJT/Z+QSGFcrw== X-Received: by 2002:a05:6512:4020:b0:478:96b3:92e3 with SMTP id br32-20020a056512402000b0047896b392e3mr11320235lfb.276.1653650541488; Fri, 27 May 2022 04:22:21 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.129]) by smtp.gmail.com with ESMTPSA id x27-20020a2e585b000000b0024f3d1dae80sm975997ljd.8.2022.05.27.04.22.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 May 2022 04:22:21 -0700 (PDT) Message-ID: Date: Fri, 27 May 2022 14:22:19 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH] XArray: handle XA_FLAGS_ACCOUNT in xas_split_alloc Content-Language: en-US To: Shakeel Butt , Johannes Weiner Cc: kernel@openvz.org, LKML , Matthew Wilcox , Cgroups , Roman Gushchin References: <348dc099-737d-94ba-55ad-2db285084c73@openvz.org> From: Vasily Averin In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/27/22 04:40, Shakeel Butt wrote: > On Thu, May 26, 2022 at 6:21 PM Matthew Wilcox wrote: >> >> On Wed, May 25, 2022 at 11:26:37AM +0300, Vasily Averin wrote: >>> Commit 7b785645e8f1 ("mm: fix page cache convergence regression") >>> added support of new XA_FLAGS_ACCOUNT flag into all Xarray allocation >>> functions. Later commit 8fc75643c5e1 ("XArray: add xas_split") >>> introduced xas_split_alloc() but missed about XA_FLAGS_ACCOUNT >>> processing. >> >> Thanks, Vasily. >> >> Johannes, Shakeel, is this right? I don't fully understand the accounting >> stuff. >> > > If called from __filemap_add_folio() then this is correct. > > However from split_huge_page_to_list(), we can not use the memcg from > current as that codepath is called from reclaim which can be triggered > by processes of other memcgs. Btw, Shakeel, Johannes, I would like to understand, when Xarray should use XA_FLAGS_ACCOUNT ? From my point of view, this should be useless: a) if Xarray stores some index (idr?) - his memory is quite small, and his accounting can be ignored. b) if Xarray stores some accounted - the size of the corresponding Xarray infrastructure is usually significantly smaller than the size of the stored object, sо his accounting can be skipped too. c) if Xarray stores some non-accounted objects - it makes no sense to account corresponding Xarray infrastructure. In case of necessary it makes much more sense to enable accounting for stored objects (and return to case b). Am I missed something important perhaps? I looked for the description of 7b785645e8f1, but o be honest I'm still not sure that I understand correctly why XA_FLAGS_ACCOUNT flag solved the described problem. Could you please explain this in more details? Was it because the non-accounted Xarray kept a reference to the stored object and thus prevents it from being reclaimed? If so, was it some special case, or should it affect all such cases, and my b) statement above is not correct? Thank you, Vasily Averin