Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1948979rdh; Sat, 28 Oct 2023 14:16:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFhCuIk52jFJcC8YBCgER6YMyclVl5UV5PUGnHTz7JzzcOwbtu1TKptdjpXU3YqclIDHRpW X-Received: by 2002:a05:6a00:1886:b0:692:a727:1fdd with SMTP id x6-20020a056a00188600b00692a7271fddmr8322399pfh.4.1698527792102; Sat, 28 Oct 2023 14:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698527792; cv=none; d=google.com; s=arc-20160816; b=uNsn9UkPHaIJvQiwrfUw3QS35oiMKIgspBdULDUUy0E52ABFNPOUiIddmt1O6iaYPB AumpniFzr1ogSU/WjXFU/dHU91IC3F6BIlxKPWxJuP0v6Bd7Qss7ojliSOKv3M42qDr6 kAUe5sNd7XB+mXr648AERmkj/LMOEvTYkKqFuBV5FLVvNm39CmVt/0Hiheypf7mquX0r BlVjyTrXcBkreB0/hfEN2S4ImW5ylXaVikQhisxEASPhI9ibekrkNlqxhUkoqUd+B2eK 5DR0pg1AGvHfqchMYum2mDcEjvByxI+7nO9ritJ9RywesbxC55xbYJlXFfkLwjpOdl+U 3BNw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=akCWBDW684115rgNSKzDVzE27lOs/49VO1ry0ooCIsM=; fh=1uPeONJOakjQQR3EtWSq4UnIQs8xDGWx2KdW6nJr7PM=; b=IuOT2tRLs8ZcXV3lwdA4suNnKBnAtnmF8+aofMpF3UrhIV9wRS2/vyfetLSbFGdgj/ H3Ef+7M7wiDfWSmdJbavxMS1ELy7bBrrhQWVr1UXBce7Pcb3LQeBky1+/GxtZtYl4mp5 +Svieh6JSECoTlmtQFWNbmeH7ZQmYYiJcMJ+g1SKlSxyifbwIl3yOkIz8vQ/FmTVukpH K1HxetyJ2GtKKQAixiafN5c9WfvCXeCSkTIqy5odZJpgsfnfpK4+8eu6tPfu9JTPYtAZ IAP61bM+C3WRtddznXwFdJurCCtmW79UpebZ5d2vwthzDI71Uujf6BICSG3Im7Gn0mjB dPxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HAkFHdXr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id c18-20020a056a00249200b00687427c1ac1si2884465pfv.25.2023.10.28.14.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 14:16:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HAkFHdXr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id F34748055AE3; Sat, 28 Oct 2023 14:16:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229749AbjJ1VJf (ORCPT + 99 others); Sat, 28 Oct 2023 17:09:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjJ1VJe (ORCPT ); Sat, 28 Oct 2023 17:09:34 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7470B8; Sat, 28 Oct 2023 14:09:32 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CB32C433C8; Sat, 28 Oct 2023 21:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698527372; bh=Wyr214KNSlnSWHwuMNRLzj8fmPHGsLCvoHa+yx4LD2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HAkFHdXrEJ5NUZx0+7uR1BgK9gapGCmVtZlckCrNLoKRh322FrjpBp5EyQxesjxAI uHpkCcfmi5pFr7LHoGu8/Q0RwEM6y622KXmLjFQ+8ZxjTFfMcz0U6NeZ6yvBOSaAOq wzP7z4L/N9gjVH/FPAPz/YA4YM3PIkS4fNMkU2ORuT0pl4AhDKLrs1L7N7rd7imngt smoA22ePDhKjc1CKDInPfCPMfxqoQCUBRyVM+3+HL3zs/tX27rfkS0Yjt+OhbT+nH1 9tevZoYzzbB8FGlY/W1Kry7tZVlbJSu/wRpJPvUpf4Ou511hW9rfPLs5iWzrkkSSN/ 7639m0hyt65Aw== From: SeongJae Park To: SeongJae Park Cc: Andrew Morton , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 1/2] mm/damon/sysfs: remove requested targets when online-commit inputs Date: Sat, 28 Oct 2023 21:09:30 +0000 Message-Id: <20231028210930.62947-1-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022210735.46409-2-sj@kernel.org> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 howler.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 (howler.vger.email [0.0.0.0]); Sat, 28 Oct 2023 14:16:15 -0700 (PDT) On Sun, 22 Oct 2023 21:07:33 +0000 SeongJae Park wrote: > damon_sysfs_set_targets(), which updates the targets of the context for > online commitment, do not remove targets that removed from the > corresponding sysfs files. As a result, more than intended targets of > the context can exist and hence consume memory and monitoring CPU > resource more than expected. > > Fix it by removing all targets of the context and fill up again using > the user input. This could cause unnecessary memory dealloc and realloc > operations, but this is not a hot code path. Also, note that > damon_target is stateless, and hence no data is lost. This is not true. 'struct damon_target' contains monitoring results (regions_list). Hence, this patch makes all monitoring results to be removed whenever doing online-commit. I was confused with init_regions at the time of this writing, sorry. I will send a fix for this soon. Thanks, SJ