From patchwork Thu Sep 28 14:15:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13403143 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 BAABDE732D0 for ; Thu, 28 Sep 2023 14:15:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D55518D0038; Thu, 28 Sep 2023 10:15:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D05158D0023; Thu, 28 Sep 2023 10:15:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA7E98D0038; Thu, 28 Sep 2023 10:15:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id AB0788D0023 for ; Thu, 28 Sep 2023 10:15:42 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3E62F40E92 for ; Thu, 28 Sep 2023 14:15:42 +0000 (UTC) X-FDA: 81286204524.19.E9E10C0 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by imf16.hostedemail.com (Postfix) with ESMTP id 25BB218001F for ; Thu, 28 Sep 2023 14:15:38 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=ZPN1iL9H; spf=pass (imf16.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695910540; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5LDfK3iMpYFB0tVun5cTOaYgiftMpgCGCTM6bYHuB7U=; b=kBj8QXaM5gPUBX9bneW2V3M3kdnGrbBM8DYN8+o7qSObG8VBBGjbnq6g25ke2tgjxKcK+m cLZGk0YzBdiC8Rw6qpAaCNUcLGMblv8yq3GQXW3uZerfT5n4X2aTwS2n2HrHujp00bFDfm KdW+l7E8IeLZPSNfr2wDIRH9PsNKqK0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695910540; a=rsa-sha256; cv=none; b=fQSEzvIVZkGUEIDkABdTGOoDDg+1/HdoU2dQOp0fsHx0YzqKk+m1wzWixA6sFrGxUgSU7+ HlbaS8nR4CgESXzrtC/6fvnF9Qj1wmoCuSN0YUxAWOM8HCSjwBm+GY+LoBBCsUjZy1DY3H xWIMjjxGSRfLhTGvd2j4M7uznofxPZw= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=ZPN1iL9H; spf=pass (imf16.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-27755cfa666so1729438a91.0 for ; Thu, 28 Sep 2023 07:15:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1695910537; x=1696515337; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5LDfK3iMpYFB0tVun5cTOaYgiftMpgCGCTM6bYHuB7U=; b=ZPN1iL9H102UaHhp2lUQ05jTfzgRgYdfrFJsc/V8KN1vUk4XUgDu/gJrGRS7nVGKIG 54xkjv0GPjVf8DGpVZyIHs4VAZpp2Xofc5YmSfV2C89SLf30UK2Xn05VO26VYqGwvkUl jQybBmKBTLgtWasoT+0QGnrW0+GlZ9V4ueh70R3L5dQOTyMHv1NWQ13miNTVh+SUdayJ shikLFTF6y2Ts1HJtjGXz9Pl7w8tCywfKU+UgtYszsJhi2eFrdvjjBF8h00QmgDEjSWq WLpgdi5MeYQX4NbQ6Q0SvqMhsCz1m6zM3S1uhCoILq8dQso2Jf4EPhVMjVIzWdKMts7b shOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695910537; x=1696515337; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5LDfK3iMpYFB0tVun5cTOaYgiftMpgCGCTM6bYHuB7U=; b=PWkAVyBmm4rRqhiz4PF5cX2b5ZS7akdcQnE9EGOz9vimLc3uiJZhX80/MwkEX1t4MW F+dLYOegn5FFxiRHoju5dC5hLlC+e2thi8jCfh0OhzrPm76ODPR9AN88fk/FGHfQk9Gx Zzq05dSLgfVH1GzyN9XDlQa704YMe3pxr+6X8yzJwiiAHzOYYuEvouPxIPwPxPCsaQfp BQKJoekmVFN9Bqamer9yfXSaRJ5Jrnq2gNbAwYm+reiu7wKuhXoPsaF7EEC1PaAgSuDo G4HxbwT6CO+iFYIXj3xrpFCwS10A+471lWAdNVOa0a4S2limkhQ/h8R8wbeYwugpjfrj 7aeA== X-Gm-Message-State: AOJu0YxG2sKtoCXNd9O4BifYiqeLBcXY6oL7cAViJhbQLf1FlSete9cz Z6gLRcrbx2/TbunkQRe2a+CtHw== X-Google-Smtp-Source: AGHT+IGaWhl+UpuFcH3vzDc3xyG9j1avZnkGKieINYm0dY8rK8BR+zrso7zpMyn1wxaTwaQ8/J4lkg== X-Received: by 2002:a17:90a:6e06:b0:278:f656:ca0e with SMTP id b6-20020a17090a6e0600b00278f656ca0emr1239830pjk.0.1695910537556; Thu, 28 Sep 2023 07:15:37 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id sf9-20020a17090b51c900b002609cadc56esm13222035pjb.11.2023.09.28.07.15.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 07:15:37 -0700 (PDT) From: Qi Zheng To: dan.carpenter@linaro.org, akpm@linux-foundation.org Cc: david@fromorbit.com, tkhai@ya.ru, vbabka@suse.cz, roman.gushchin@linux.dev, djwong@kernel.org, brauner@kernel.org, paulmck@kernel.org, tytso@mit.edu, steven.price@arm.com, cel@kernel.org, senozhatsky@chromium.org, yujie.liu@intel.com, gregkh@linuxfoundation.org, muchun.song@linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Qi Zheng Subject: [PATCH] fixup: mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred} Date: Thu, 28 Sep 2023 22:15:17 +0800 Message-Id: <20230928141517.12164-1-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230911094444.68966-41-zhengqi.arch@bytedance.com> References: <20230911094444.68966-41-zhengqi.arch@bytedance.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 25BB218001F X-Rspam-User: X-Stat-Signature: iobrpo8b8k565dt7u5zje6jsdufdohhf X-Rspamd-Server: rspam03 X-HE-Tag: 1695910538-699510 X-HE-Meta: U2FsdGVkX193QiEorp+eiR5ZLBpYaqwuChYcLr071gN1opOjyEqTKJLfwvOOtOnTra0gvin7hoETi276oxGaufL0e6G8AeB9zhXGaJghiMX7kHNVb3ZB5ybh6chaFsliRkEwuRjEknPH+Zo3oTb22tosroL1msFl9MmX27KWkkUT1hsfjZxw1CZ+Bxb51YrQGWGU/O1rpx9yvYf+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ee5Uejh416LH4KR1EIUqIecZm8abIS5Aqs7euX1SKsEZ8a91gMyCLWKXnPpj6Z9BIyrXjOijJYKTQFXnpuan6chIfctLkGR8LupfcC3aInSL+OiO/DGeE4CBueWiiVP50ScOwALh+uMNZDwQZHxQbmoXkZxxDgiVpOXGG7bgs0GwZQT4Ukon4W5ZBOYVnBTkXaoSoow= 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: Dan Carpenter reported the following bug: ``` The patch b6884b5f15cf: "mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred}" from Sep 11, 2023 (linux-next), leads to the following Smatch static checker warning: mm/shrinker.c:100 alloc_shrinker_info() warn: inconsistent returns '&shrinker_mutex'. ``` To fix it, unlock the &shrinker_rwsem before the call to free_shrinker_info(). Reported-by: Dan Carpenter Closes: https://lore.kernel.org/linux-mm/f960ae49-078c-4c00-9516-da31fc1a17d6@moroto.mountain/ Signed-off-by: Qi Zheng --- mm/shrinker.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/shrinker.c b/mm/shrinker.c index 893079806553..e9644cda80b5 100644 --- a/mm/shrinker.c +++ b/mm/shrinker.c @@ -95,6 +95,7 @@ int alloc_shrinker_info(struct mem_cgroup *memcg) return ret; err: + up_write(&shrinker_rwsem); free_shrinker_info(memcg); return -ENOMEM; }