Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3271099iob; Mon, 16 May 2022 17:45:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyW5TwdKbWrBWHd17o5PpMmFi7VxN+7L1Ndui896wJ2EBSX6vvhJuPNFma32xd4gG4cUdE2 X-Received: by 2002:a17:90b:1e49:b0:1dc:81d9:2d97 with SMTP id pi9-20020a17090b1e4900b001dc81d92d97mr33719600pjb.221.1652748356578; Mon, 16 May 2022 17:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652748356; cv=none; d=google.com; s=arc-20160816; b=skbh0NyOl8XS88nbK4DgNa0N1yDcrsFH9fFSDZVU2Kb5WsUEoN8/Rn9ILgfzlEi3iw dJgvyxYwVknO4aF1Sh+Es+xKBZe9kS6JtFRSSbexYWe18rzhijvfyvgPZR1b/KzWoNEh TJDOWv63d7mHuDo6fM7EXxzLFafVarB2cGn3v2cB9me89kY0fhQJBSk0zTbueOj1yh/3 rNrys1RJ4TFw9degwRzaVwPy+vMQFdRN/wJc+vrXKUZOeKifyx9+ILNzgKPpEriq6MAF wWm393MQj5Ifcm1joxbgndYniimqG8m+k6ur9Gg9XH9ZF10Kc3Xo7s+pm9FtSjmO0xAx 7bAw== 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:cc:to :subject:from:user-agent:mime-version:date:message-id:dkim-signature; bh=nuaRCyZ3f8/tAk5NBkEcb+gaJ9vpmmFYS74QQLXNLAk=; b=Kuf38dUasDFEkg7bnMLvUGaa1DOgJDKX1NFll5P4dFv7tjxW/ZKMrxz7MyAn8u2GwD 6e5KUQi6Wzg0LFIUApCpWfdzCeJh2+/EqZIosudG8SVk2nVQw28ZTj/RYQ7vjbBABxmx QAhf6cTGddEaH9piZTGd4L9uoTaNKqbpm6KIBdyq46+Mb2qU+UuIoQYgfbGNRFcs1shb NA8TxGsIsTLuPEqQJynv4zDuHdedWlDrjjfNGq8rTq23KM6q1bhm7NSqpZM637STzpfG 4JTa6RE300PFzabWu1Kaju9CUvvv4eCWf1xwWe1gQv+4TD4rJMdpdTEb9JZihNnvkTrU Um6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=uHW2EOkn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a1709029a4200b0015d2e44c194si13140844plv.556.2022.05.16.17.45.45; Mon, 16 May 2022 17:45:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=uHW2EOkn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345168AbiEPSxj (ORCPT + 99 others); Mon, 16 May 2022 14:53:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232386AbiEPSxh (ORCPT ); Mon, 16 May 2022 14:53:37 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E7CB3EABB for ; Mon, 16 May 2022 11:53:36 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id g16so19255122lja.3 for ; Mon, 16 May 2022 11:53:36 -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:from:subject:to:cc :content-language:content-transfer-encoding; bh=nuaRCyZ3f8/tAk5NBkEcb+gaJ9vpmmFYS74QQLXNLAk=; b=uHW2EOknJrrdEJKCG/9WPjfw9+6HT1KxNEanFdBQTCPYnK+1353SmGzP9S4QOZIkBM USeZ6AT9OmZ1K/5kggz51UgdnUpkAKg5hiZxDmRECbfTH7AUbRw0vfesKIX5WCM140pa 1lzo6/pJrYfCkGtdWfIO/olD1whWCjh70BZ+vzfstWpzXGH/S8Vva2BtDXFWv32Zq9X7 VfXEvKtN8dWYgZSekKRsgMYcLiftUAQwGhES7+8UCu9rwRvDqFGZWoXBjPu//0DHBMYw +F/B0aOwFrSH9r7lDT0Sb/zV/FNIpGYLQu/tSluvf7mGdOyZWQJPsXZsSQDf4tJ2qANp GSIA== 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:from :subject:to:cc:content-language:content-transfer-encoding; bh=nuaRCyZ3f8/tAk5NBkEcb+gaJ9vpmmFYS74QQLXNLAk=; b=nm2rIoyE/0o+A2hszPgay9Tft8m6xAvU8e3YElTC9Uu8VjGWG6Nl+87YLiiUIVp8RH Bzf4z/2aJ0gJqRFRDLvYOes2rNscE7MbXVmFojb3GVP/wh9WDYz6BURCAO3Y75VBrydI UY0PS4YYcxfMctxmZE1oIOa1kYErgDuAV/cOYrGlkhCBkh0Vp8aHSLoW9Rpb+NBdNnn+ NyqDl6XI0sfkqxD9oXHAl/Sim2E3k+wN8hkbrs02YST973RLIKTsmmgX+h32yDnPntiu LxM/rTcIMolj3CnjvyxXf+IlQa9SDxMzjBmkxxL8fLHO13w2n/SqS4vmJDxZH0+gav7C 7XUg== X-Gm-Message-State: AOAM531WS7ioXAvnW1DkPPFT7UGed58N2TbbwP5ZFhow17AGDi6R4093 yDcKBICDat6tLYNZtBttvcpd4g== X-Received: by 2002:a2e:9dc8:0:b0:24f:d84:3001 with SMTP id x8-20020a2e9dc8000000b0024f0d843001mr11931801ljj.435.1652727214669; Mon, 16 May 2022 11:53:34 -0700 (PDT) Received: from [192.168.1.72] (46-138-221-128.dynamic.spd-mgts.ru. [46.138.221.128]) by smtp.gmail.com with ESMTPSA id w8-20020a2e3008000000b00250664c906asm1639086ljw.133.2022.05.16.11.53.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 May 2022 11:53:34 -0700 (PDT) Message-ID: <1fd21e25-b095-e055-fc2e-abda640a0575@openvz.org> Date: Mon, 16 May 2022 21:53:32 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 From: Vasily Averin Subject: [PATCH] tracing: add ACCOUNT flag for allocations from marked slab caches To: Roman Gushchin , Vlastimil Babka , Andrew Morton , Joonsoo Kim , David Rientjes , Pekka Enberg , Christoph Lameter Cc: kernel@openvz.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Shakeel Butt , Michal Hocko Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Slab caches marked with SLAB_ACCOUNT force accounting for every allocation from this cache even if __GFP_ACCOUNT flag is not passed. Unfortunately, at the moment this flag is not visible in ftrace output, and this makes it difficult to analyze the accounted allocations. This patch adds the __GFP_ACCOUNT flag for allocations from slab caches marked with SLAB_ACCOUNT to the ftrace output. Signed-off-by: Vasily Averin --- mm/slab.c | 3 +++ mm/slub.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/mm/slab.c b/mm/slab.c index 0edb474edef1..4c3da8dfcbdb 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -3492,6 +3492,9 @@ void *__kmem_cache_alloc_lru(struct kmem_cache *cachep, struct list_lru *lru, { void *ret = slab_alloc(cachep, lru, flags, cachep->object_size, _RET_IP_); + if (cachep->flags & SLAB_ACCOUNT) + flags |= __GFP_ACCOUNT; + trace_kmem_cache_alloc(_RET_IP_, ret, cachep->object_size, cachep->size, flags); diff --git a/mm/slub.c b/mm/slub.c index ed5c2c03a47a..670bbfef9e49 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3231,6 +3231,9 @@ void *__kmem_cache_alloc_lru(struct kmem_cache *s, struct list_lru *lru, { void *ret = slab_alloc(s, lru, gfpflags, _RET_IP_, s->object_size); + if (s->flags & SLAB_ACCOUNT) + gfpflags |= __GFP_ACCOUNT; + trace_kmem_cache_alloc(_RET_IP_, ret, s->object_size, s->size, gfpflags); -- 2.25.1