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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D7A6C433E0 for ; Fri, 5 Mar 2021 17:38:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9E4A5650A3 for ; Fri, 5 Mar 2021 17:38:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E4A5650A3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 326FF6B006E; Fri, 5 Mar 2021 12:38:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B0076B0070; Fri, 5 Mar 2021 12:38:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12A046B0071; Fri, 5 Mar 2021 12:38:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0173.hostedemail.com [216.40.44.173]) by kanga.kvack.org (Postfix) with ESMTP id E42DD6B006E for ; Fri, 5 Mar 2021 12:38:15 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 981ED180ACC54 for ; Fri, 5 Mar 2021 17:38:15 +0000 (UTC) X-FDA: 77886529350.17.4EB28CD Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by imf22.hostedemail.com (Postfix) with ESMTP id 3F8D4C0007C0 for ; Fri, 5 Mar 2021 17:38:11 +0000 (UTC) Received: by mail-lf1-f48.google.com with SMTP id p21so4918371lfu.11 for ; Fri, 05 Mar 2021 09:38:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=uuw+r0jQlL0C1Mfdgw9EQ8CLOfFkvjoYJUZ0Y+AoHzc=; b=boCRkK/DszBNzEo6K8w24Z7IRM43JPPa4FqpDZKMLitRXqOQkE4RB/WT6Y+yQEFZsw byRDsn3/XREGSJ+zs8u8QSzJ69xzjMknQ4MwkKyf2tA0QDhJa6LqMB8+/rCLqgqoDOeZ G4qYPw5iC+TbKxHXjmlLoXIEEP5caLaBBGHgUU77nroDrYi4xopwwbu2ddcVMRgKkFAj J+9GqzGh3puhiwG0IWWRhW6IeoseKXNAZqypJ5ok50OZd1nmBq2kujFM7wjgeDOAykw6 k4qk2wIfsnH02GhOLhHALTZb5a4OcUxWIiabrEPWAuDAm1L3epyCT0tv0+B3QHsL/QQy 4vMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=uuw+r0jQlL0C1Mfdgw9EQ8CLOfFkvjoYJUZ0Y+AoHzc=; b=r7HHCuJbVabFvMLfiF6nZ2LTfhzmQHZZztIucgYEHM4aNfasrKIOl1lsojwlt8vbE3 f+vcf8cWutdFjFhAxc1zbI04nvfo2Nkg+xuy3LmcMlkvAgYhXMiVSUvOnCw78W9c98t9 OpR8gK9Nri3cOa4CNb5NXdT2f75jYB9Mx0YqoS948hxJPZ/adTD96uzb6KxrA09VjwOp MSJKO61h3IQ4JnZp09QktfByyZgXNLEtq08byZJmupGF3AlgS3umLfXGQmXbwKNFgb+w ZczyTXsndfi7Ayvi0x65vEl5MZtgg/HNeqcZl5wkDDAokveTIZClccLBag2H+9EcZNBK GDCQ== X-Gm-Message-State: AOAM533TlBonbB9pdLtraDiJBlb+4XQSayuRhcWl64AV1yM4KWYcPry0 L6kun4phroW+QOu5uuDR5APGaw== X-Google-Smtp-Source: ABdhPJxlJqPIE7Ga8oqvRozSRl4EZZvdE6mgwzvAi3kTeTXr5gJIDv0zIfSzItTozic4noLTzCQNbQ== X-Received: by 2002:a05:6512:47b:: with SMTP id x27mr2367793lfd.37.1614965890563; Fri, 05 Mar 2021 09:38:10 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id v80sm381213lfa.229.2021.03.05.09.38.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 09:38:10 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id 7B93010257C; Fri, 5 Mar 2021 20:38:09 +0300 (+03) Date: Fri, 5 Mar 2021 20:38:09 +0300 From: "Kirill A. Shutemov" To: Miaohe Lin Cc: akpm@linux-foundation.org, riel@redhat.com, kirill.shutemov@linux.intel.com, ebru.akagunduz@gmail.com, dan.carpenter@oracle.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 4/5] khugepaged: remove unnecessary mem_cgroup_uncharge() in collapse_[file|huge_page] Message-ID: <20210305173809.ufg6rfgmvgbvwxih@box> References: <20210304123013.23560-1-linmiaohe@huawei.com> <20210304123013.23560-5-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210304123013.23560-5-linmiaohe@huawei.com> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 3F8D4C0007C0 X-Stat-Signature: tkm95r5o4wmr7i9uwetwbft7osbz7afb Received-SPF: none (shutemov.name>: No applicable sender policy available) receiver=imf22; identity=mailfrom; envelope-from=""; helo=mail-lf1-f48.google.com; client-ip=209.85.167.48 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614965891-216231 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 Thu, Mar 04, 2021 at 07:30:12AM -0500, Miaohe Lin wrote: > Since commit 7ae88534cdd9 ("mm: move mem_cgroup_uncharge out of > __page_cache_release()"), the mem_cgroup will be uncharged when hpage is > freed. Uncharge mem_cgroup here is harmless but it looks confusing and > buggy: if mem_cgroup charge failed, we will call mem_cgroup_uncharge() > uncorrectly in error path because hpage is not IS_ERR_OR_NULL(). > > Signed-off-by: Miaohe Lin Hm. I'm not sure about this patch. For !NUMA the page will get allocated and freed very early: in khugepaged_do_scan() and with the change mem_cgroup_charge() may get called twice for two different mm_structs. Is it safe? -- Kirill A. Shutemov