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=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=unavailable 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 8EC63C433F5 for ; Thu, 16 Sep 2021 16:37:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 739A561B62 for ; Thu, 16 Sep 2021 16:37:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244239AbhIPQii (ORCPT ); Thu, 16 Sep 2021 12:38:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:44326 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241474AbhIPQbJ (ORCPT ); Thu, 16 Sep 2021 12:31:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E31E66137D; Thu, 16 Sep 2021 16:19:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809154; bh=fYi5Vj0hvNhaeRT8uo3OjxcwrFslV1ekSpdFtnZZzBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BM7e5RlM3MJB3GDrUbdBaLHhsfOm+Z7/tJCpgqLD+Wf3dEL7M43ccHgbDBTBmnosw UEqwRHEYaO+9CjkW4I7YsP17xiSiCPBWvRNsxotTD8RqK6YjtaA0A0M5CbPlYlcYoG fYaBMMbpeNxZ9LKKlJlHIn15n57c631zndbWxV1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 5.13 051/380] io_uring: place fixed tables under memcg limits Date: Thu, 16 Sep 2021 17:56:48 +0200 Message-Id: <20210916155805.717753236@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Begunkov commit 0bea96f59ba40e63c0ae93ad6a02417b95f22f4d upstream. Fixed tables may be large enough, place all of them together with allocated tags under memcg limits. Cc: stable@vger.kernel.org Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/b3ac9f5da9821bb59837b5fe25e8ef4be982218c.1629451684.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/io_uring.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -7195,11 +7195,11 @@ static struct io_rsrc_data *io_rsrc_data { struct io_rsrc_data *data; - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = kzalloc(sizeof(*data), GFP_KERNEL_ACCOUNT); if (!data) return NULL; - data->tags = kvcalloc(nr, sizeof(*data->tags), GFP_KERNEL); + data->tags = kvcalloc(nr, sizeof(*data->tags), GFP_KERNEL_ACCOUNT); if (!data->tags) { kfree(data); return NULL; @@ -7477,7 +7477,7 @@ static bool io_alloc_file_tables(struct { unsigned i, nr_tables = DIV_ROUND_UP(nr_files, IORING_MAX_FILES_TABLE); - table->files = kcalloc(nr_tables, sizeof(*table->files), GFP_KERNEL); + table->files = kcalloc(nr_tables, sizeof(*table->files), GFP_KERNEL_ACCOUNT); if (!table->files) return false; @@ -7485,7 +7485,7 @@ static bool io_alloc_file_tables(struct unsigned int this_files = min(nr_files, IORING_MAX_FILES_TABLE); table->files[i] = kcalloc(this_files, sizeof(*table->files[i]), - GFP_KERNEL); + GFP_KERNEL_ACCOUNT); if (!table->files[i]) break; nr_files -= this_files;