From patchwork Sun Oct 22 21:07:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 15730 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp945865vqx; Sun, 22 Oct 2023 14:08:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEEE4fXKo51PhcvWs1lySDxeHhO/uj8A9djxOLrdy4/TVYcsEQjkdtwSeptEBSUtxEwASYg X-Received: by 2002:a17:90a:19c5:b0:27c:eb7f:cd00 with SMTP id 5-20020a17090a19c500b0027ceb7fcd00mr4814989pjj.22.1698008890681; Sun, 22 Oct 2023 14:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698008890; cv=none; d=google.com; s=arc-20160816; b=kMyG8RbxWjx4TJtONTWOhSav6IcWnsTTxVYN0ebMG63J/O8YBS435v34AX/vjAY3GO F+t1NJaLz1A9dUWQ9tmXN6w0UAD8K2fHu89POItwuXsfNzFytY06XD+tsWfD/3snluHA Jp7guIwEqtNxILTu8iJb0madEjOh1EdH4I6RxtT66exfq/uVwHQ+mzPwquxo+OH9Vyg3 w92qH4ptu/oWrF0EH42lfIX1VtdTjIDBBuL+r8kcGJI4RCTnI+j4kbv9bMTBk6QhkCY1 grWqCnj8wOd58Ku41huJlSb3UICQEXVNPNo255KVpav7nvFRyWZ9a/mJef9/Ls9ZBcbT ji6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=OuUWQvtqVqr2NfmDy/zX5WMRE0DzQtB4zn3VhdH+/WM=; fh=KYrqrUZLyrFtzsRGU6oAoSUmY0DAP9CMMvmnxe+fdzY=; b=d0UwbxqWuIVt3Rb7HZquEd5/mkjnf1yKy1DbIBnfPvq0hBuqZKJu4vmG5BAXvfHt+V ZCFTqb5a/Dl7IY0X/kUYm5rObKAh8yVxBAMK/KpkD5BkyjXqBdYmsCrmph9QMkbGZNpW n3+UDK5lckZPivKDyvW96Gblbgve0IjRw5aYsl4jr/S/SWGzVYXJMLOSjt+PM1iH3Km2 OTNpdhi4BrcgbTLSusI/xBwWCcGj1X99Ryl7yTtwaHyd+v/G9oe90XUd3XF9RGTquxYp 9QT4VmYFeCGtgffpKnpO0tsFswzfIs1AROzjZ4CK1Yv65TJ/Ngup5Fwcb2cVFSduyBWz acRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mr2+dXiJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id v8-20020a17090a898800b002791e648ceasi5341853pjn.112.2023.10.22.14.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 14:08:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mr2+dXiJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 5BCA3805CB6A; Sun, 22 Oct 2023 14:08:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232655AbjJVVHn (ORCPT + 27 others); Sun, 22 Oct 2023 17:07:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjJVVHm (ORCPT ); Sun, 22 Oct 2023 17:07:42 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C28FDD; Sun, 22 Oct 2023 14:07:40 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A11FC433C8; Sun, 22 Oct 2023 21:07:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698008860; bh=5ZgrkUlzCX47pRqWIhyU/veHGqYnGCkei+KNQLGqf1A=; h=From:To:Cc:Subject:Date:From; b=Mr2+dXiJPkTQamZC9s42dpr+F9W0/gxa5/gu5u+m66R8FYIBTu1+AJbCM7duHuFnV 3wskyjxpue0Cbn0GZW2V/05/NCIVgiaAzmfVSD1FpZae9HpvNdmj4rSL1u6iD383OY HAOGHljzTiXsfZ3c9WqoZKRhR20LSG6+PmC/dkp01D3CnjTnnJCpGa4WdmjDFWfaHe uQcj1QvuBJ+k/kSaQmTV7H/F/W8CDV20wOCgNSog60fqpbeY8lgJ3oKq82Sznwbgo2 iXDj0VOAx9IfaMuGqZhgao0fXWepdy2vr6wDH0s6hp5q37mgSiAxNbTu/8jyOkpS/n tKvX3/xb3NJrQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Brendan Higgins , damon@lists.linux.dev, linux-mm@kvack.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/2] mm/damon/sysfs: fix unexpected targets adding bug Date: Sun, 22 Oct 2023 21:07:32 +0000 Message-Id: <20231022210735.46409-1-sj@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sun, 22 Oct 2023 14:08:08 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780491370243814903 X-GMAIL-MSGID: 1780491370243814903 The sysfs code for online targets updating can result in adding more than expected monigoring targets to the context. It can result in unexpected amount of memory consumption and monitoring overhead. This patchset fixes the issue (patch 1), and add a kunit test for avoiding similar bug of future (patch 2). SeongJae Park (2): mm/damon/sysfs: remove requested targets when online-commit inputs mm/damon/sysfs-test: add a unit test for damon_sysfs_set_targets() mm/damon/Kconfig | 12 ++++++ mm/damon/sysfs-test.h | 86 +++++++++++++++++++++++++++++++++++++++++++ mm/damon/sysfs.c | 52 ++++++-------------------- 3 files changed, 109 insertions(+), 41 deletions(-) create mode 100644 mm/damon/sysfs-test.h base-commit: 9a969da6ffb9609f5fa8d0b7fdc6859c37a10335