Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4996890pxb; Tue, 2 Nov 2021 20:42:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuBudH6VfeCWKM+qw1T2zxUGV5z+05U4PTMcFqnfmBuxrEiFLhSkWdBLvwNWFQaZh0/5oH X-Received: by 2002:a05:6638:248a:: with SMTP id x10mr13253079jat.23.1635910965186; Tue, 02 Nov 2021 20:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635910965; cv=none; d=google.com; s=arc-20160816; b=w7yj4APlpTou02ESRJmpVV3yOGRNKzMcGMY1R05B/QdeLxlX9O9sY/fr+YlHRfBYv+ ECdFaIslzXEuAsP5Nnh+JeDP9YChCCGFsesFukWPqxl/YxvX+coa2PyjLSi53Tb1T1vd kyBtWYAeMP31AwS4qgJ0YP0PN3sMWDT8CqZQcQzcuszIX0+uz81VBG8orYoQ22u8iER2 lyLuyYvJYRaZq43tr+HIlI+lV5cz2MYfsSUxbLhdtzFOsqPg+Npf9Phgo54+/Qa3q7Nz mHb+f6xHRBZiJQTpOYmQ5UcDxMzhRwxoSBBlUOVlatXWMM2gy1ayZHBWJ27scbIjMUiG u0jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=wCfhorJSI3npXNGMbVwDdB6XLcKVtaNti1Y437nAbDE=; b=OXS3oJ+9NuArwvoDzdgekz2F/vvOuWMX3EyzHpfjzmSG/kzILb6raerKkZgoPrPjx7 BOSirZe0pfDLINIwSDmd67MNapKUBz0pVPm61cPkmOEGomCmB9Fx285s9zMNVlkUFOGZ s6UP1wcwlZFlVF6wTSOTzijCCOVrJbsZfJgVVKl8y1lKyBrvTrTLEVUtEJE4ydQr5XUO LdM9RCo2lYc/wgUxnEEWcxhe+esCkYbjdRt4IhFXVBElC9byUR70r0QzMmVTBB2iO1nf I46Ame9VGqEyjAddeXAVdpcumVfPeJrpPLsvqCYDUtDO8ptoAEDK3TDEoh+myG31ObH3 5GxQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w4si1192093ilv.3.2021.11.02.20.42.33; Tue, 02 Nov 2021 20:42:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230054AbhKCDoM (ORCPT + 99 others); Tue, 2 Nov 2021 23:44:12 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:15351 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbhKCDoL (ORCPT ); Tue, 2 Nov 2021 23:44:11 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4HkXcj11vrz90gD; Wed, 3 Nov 2021 11:41:25 +0800 (CST) Received: from dggpeml500024.china.huawei.com (7.185.36.10) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Wed, 3 Nov 2021 11:41:27 +0800 Received: from [10.174.176.231] (10.174.176.231) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Wed, 3 Nov 2021 11:41:26 +0800 Subject: Re: [PATCH v2] mm, slub: emit the "free" trace report before freeing memory in kmem_cache_free() To: John Hubbard , , , , , Andrew Morton , , , CC: , , , Hewenliang References: <6ba0f3d0-cf93-9fb3-d691-962e1cb65eb4@nvidia.com> From: Yunfeng Ye Message-ID: Date: Wed, 3 Nov 2021 11:41:26 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <6ba0f3d0-cf93-9fb3-d691-962e1cb65eb4@nvidia.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.176.231] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/11/3 2:37, John Hubbard wrote: > On 11/2/21 04:43, Yunfeng Ye wrote: >> After the memory is freed, it can be immediately allocated by other >> CPUs, before the "free" trace report has been emitted. This causes >> inaccurate traces. >> >> For example, if the following sequence of events occurs: >> >>      CPU 0                 CPU 1 >> >>    (1) alloc xxxxxx >>    (2) free  xxxxxx >>                           (3) alloc xxxxxx >>                           (4) free  xxxxxx >> >> Then they will be inaccurately reported via tracing, so that they appear >> to have happened in this order: >> >>      CPU 0                 CPU 1 >> >>    (1) alloc xxxxxx >>                           (2) alloc xxxxxx >>    (3) free  xxxxxx >>                           (4) free  xxxxxx >> >> This makes it look like CPU 1 somehow managed to allocate mmemory that > > > I see I created a typo for you, sorry about that: s/mmemory/memory/ > > But anyway, the wording looks good now. Please feel free to add: > > Reviewed-by: John Hubbard > Ok, I will fix the typo in the v3 patch. Thanks. > > thanks,