From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED610C43334 for ; Tue, 7 Jun 2022 12:37:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6048C6B0072; Tue, 7 Jun 2022 08:37:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 58C256B0073; Tue, 7 Jun 2022 08:37:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4051E6B0074; Tue, 7 Jun 2022 08:37:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 2AA406B0072 for ; Tue, 7 Jun 2022 08:37:57 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id EBEEF80A28 for ; Tue, 7 Jun 2022 12:37:56 +0000 (UTC) X-FDA: 79551391752.06.E9BAFD7 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by imf25.hostedemail.com (Postfix) with ESMTP id 16398A006C for ; Tue, 7 Jun 2022 12:37:16 +0000 (UTC) Received: by mail-lf1-f54.google.com with SMTP id s6so28059442lfo.13 for ; Tue, 07 Jun 2022 05:37:54 -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=7VWPEvvINNs28ioVlXIeYh81foNtBWzaOhBPLFOuk84=; b=XrDpP52+3EO0X6LweAf3F2Fn+6FcjsCkhpPi7cjUn8ibrMfSb3D2UbsdA6Orz2hz6W //fYF1I8NLKAdicy7sFdjyHXNKIREf3piAeuQEU3Z2Kf+IN/ONt/N0N7mgpRrygVEzRB +uUhMhRCs+Z5gNM2IRxJ24vhTiSjTVXTaghQVEWUPss4PLhOCP/yNOmaDmX7orALggYF xKeGKvLDPSJX6bLRhtSS63GFgPcMZcTyA0lY+Po8NSF7k54K5O3TbvZxudLTQPWbRZ81 hffyMNvw50jHBWi7EJiXxKJbXdYVuHNEv+gXDpQiL6y/EmPXZw1ODm24jBWpW1vh1e2G ocIg== 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=7VWPEvvINNs28ioVlXIeYh81foNtBWzaOhBPLFOuk84=; b=S6mXZu1U4Pm0ZcU2/FmMYwzqbOg1uVVCfNPjP32J8ATUI8C6Uz4F80eSCoecHR9r6J Wxj2C7U136Fbxm6FpJUe0iLhNvqEoRlykNt0KoAD1BcNgXOa++bHxZJ0C0xxwxY+bOq3 bAmwN6vBN6ALHfhNz61avutvMebcVM+3Etz2TCgYJTXOkPhK7K7wGE3lId8bMn123hux EGhA063ZR4yPfPPjPzHu+fbtVokAzOC+1Ra9R7G4J3R/HAw6o1tiFToUYJq30akXIHwj b8io3pyi+GPVpVLm0/C3gM0u8ZlW2RCX6QFNSHIVPm7tzGluyVotKPuBVRHUQiItBCG3 /45w== X-Gm-Message-State: AOAM530S0G3aNbMHhBG5Disxme8Ia1J5Te6Xsgbxo9SH7b0ydejREQuq Bxi7DLkxsbTQ4O+FI9qjFhCe8Q== X-Google-Smtp-Source: ABdhPJzV9Qt/IJjZLnDs9mVZaiwTHIWH8UWlNQ4D39gnJl4yH8fvtKfqfo+tQeFCBSnZIFydBQ7JhA== X-Received: by 2002:ac2:5d22:0:b0:478:9e46:ae85 with SMTP id i2-20020ac25d22000000b004789e46ae85mr18388836lfb.126.1654605473561; Tue, 07 Jun 2022 05:37:53 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.129]) by smtp.gmail.com with ESMTPSA id q23-20020a05651232b700b00478ffd14ac1sm3259016lfe.163.2022.06.07.05.37.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jun 2022 05:37:53 -0700 (PDT) Message-ID: <183333fc-e824-5c85-7c44-270474f5473a@openvz.org> Date: Tue, 7 Jun 2022 15:37:51 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH memcg v6] net: set proper memcg for net_init hooks allocations Content-Language: en-US To: Shakeel Butt Cc: Qian Cai , Roman Gushchin , Andrew Morton , kernel@openvz.org, LKML , Linux MM , =?UTF-8?Q?Michal_Koutn=c3=bd?= , Vlastimil Babka , Michal Hocko , Florian Westphal , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , Cgroups References: <6b362c6e-9c80-4344-9430-b831f9871a3c@openvz.org> <360a2672-65a7-4ad4-c8b8-cc4c1f0c02cd@openvz.org> From: Vasily Averin In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Stat-Signature: t51bhmdo4cdt5dnnwum8s9z3wmqzf4ka X-Rspam-User: Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=XrDpP52+; spf=pass (imf25.hostedemail.com: domain of vvs@openvz.org designates 209.85.167.54 as permitted sender) smtp.mailfrom=vvs@openvz.org; dmarc=pass (policy=none) header.from=openvz.org X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 16398A006C X-HE-Tag: 1654605436-980733 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 6/7/22 08:58, Shakeel Butt wrote: > On Mon, Jun 6, 2022 at 11:45 AM Vasily Averin wrote: >> > [...] >> >> As far as I understand this report means that 'init_net' have incorrect >> virtual address on arm64. > > So, the two call stacks tell the addresses belong to the kernel > modules (nfnetlink and nf_tables) whose underlying memory is allocated > through vmalloc and virt_to_page() does not work on vmalloc() > addresses. However in both these cases get_mem_cgroup_from_obj() -> mem_cgroup_from_obj() -> virt_to_folio() -> virt_to_page() -> virt_to_pfn() -> __virt_to_phys() handles address of struct net taken from for_each_net(). The only net namespace that exists at this stage is init_net, and dmesg output confirms this: "virt_to_phys used for non-linear address: ffffd8efe2d2fe00 (init_net)" >> Roman, Shakeel, I need your help >> >> Should we perhaps verify kaddr via virt_addr_valid() before using virt_to_page() >> If so, where it should be checked? > > I think virt_addr_valid() check in mem_cgroup_from_obj() should work > but I think it is expensive on the arm64 platform. The cheaper and a > bit hacky way to avoid such addresses is to directly use > is_vmalloc_addr() directly. I do not understand why you mean that processed address is vmalloc-specific. As far as I understand it is valid address of static variable, and for some reason arm64 does not consider them valid virtual addresses. Thank you, Vasily Averin