Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1735756iob; Fri, 29 Apr 2022 11:34:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxt0G2vhDjtp9IIlWyhUzDiHkVfXUbKhV1lD0k9CuRtjcqTu13eseqrAJiFocDAnif73OgD X-Received: by 2002:a63:4a02:0:b0:39d:b8ac:59a4 with SMTP id x2-20020a634a02000000b0039db8ac59a4mr545427pga.464.1651257244530; Fri, 29 Apr 2022 11:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651257244; cv=none; d=google.com; s=arc-20160816; b=T+02/RMT7+x3WK855Z4GXwTglqKEUxf4fRlX8h0fuz3WZ71GP3khnWfGQhC429EtkR mGt6KJIIRTBRUQJ4fKSMN/SD13xqtsR2mFaGvMgE6i/4NKnKzy5eVE6HK9zV62aRV1Zo eQ/mCWeOT8KRATTrBazgQWPnGStgMFYx+pf0pCzLEeOMRWgLkCINIK3UmceU27nRikhv VG5cSSfmhY4LYZoJI0pUUmZoPYPJzwYUXQsRjeF/IcvmWHTTOYAJAMQYB5gTJuvj0qA5 PpIb9tue0tUT6eR41ea6DVWW8z6IAaQtrPEAgN1wSrxWHZd2mBxzOB/624zBdCgh9bv7 3AJg== 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=zv3oBfbx0Hs3I6+R2ai64XW2ckYCLjbtude6NSR7L1Q=; b=gIVc3zsbOGhbqDcKVVrikiugCXA/NAuAhlfKfOBI1kRp/q2RqEx1Dt+OCkn6ppGnuU wo6iYPIP3r0H38UONU7TYXizEksWdoGPn9y0Pv74uwYcdQp9T5K0KJwFlw2JRwgoYacp AYXkWKSTpTM8CFFlTOFxwmOnjkO+OM+5SP8EYSLHno6qT0B6EFyI5T7U0QQVdPnAWSSj ll3tORmYI8xbdeYGp8mH/YJcovJHbAz6Kdnl4/qsvh7SQ0FEo4CrphVFQbR6BzVpYTxK c7iRQ59N4D2+czpifAo7PieoY2Q1N5vBGtxKReYnN7T2w7HFWAkFOK7BQL3LRlPjk0Q5 yxIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X9FMxOBb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q13-20020a170902eb8d00b00153b2d1645esi6791873plg.102.2022.04.29.11.33.45; Fri, 29 Apr 2022 11:34:04 -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=@kernel.org header.s=k20201202 header.b=X9FMxOBb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359757AbiD2QKA (ORCPT + 99 others); Fri, 29 Apr 2022 12:10:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378834AbiD2QJl (ORCPT ); Fri, 29 Apr 2022 12:09:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86D85A27D9 for ; Fri, 29 Apr 2022 09:06:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2E7E8B83642 for ; Fri, 29 Apr 2022 16:06:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AC0FC385B0; Fri, 29 Apr 2022 16:06:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651248378; bh=Hcue4UkSxQRyEUzwbaytE02Er4fLlaTR3fDdxJ0RqWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X9FMxOBbdtErkeAclj4pzR65QPA31ltzHi4e6XJQM1s+FcZkV8NW3jZrxHT2kHkF4 lv5UHIsB+Z2ImbsF3l86/aSgp1oqfUZV43FKtLrX6hFKGqcvEbeKeazCUwW2kZ1IKK jSULCIeRy4oSW72G6pLsH8tUo0EKls6kOFv5KYp5cp0u/7ywvBllY90Xnz60L3qZnp HDDWHwiMC7WTAkIdr3X+rIv7Y0ZxKo21GeHrtCtuWW+LmijIvl7cff6mPLYYd6v8ts xDzEupUY0o8tb8JzJQ5pewg8RwoVHk3636mxTHYuJtX2PicCTnfLlLvuC4WC5W9I+o l7sWU07sJhCgg== From: sj@kernel.org To: akpm@linux-foundation.org Cc: linux-damon@amazon.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 06/14] mm/damon/sysfs: prohibit multiple physical address space monitoring targets Date: Fri, 29 Apr 2022 16:05:58 +0000 Message-Id: <20220429160606.127307-7-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220429160606.127307-1-sj@kernel.org> References: <20220429160606.127307-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: SeongJae Park Having multiple targets for physical address space monitoring makes no sense. This commit prohibits such a ridiculous DAMON context setup my making the DAMON context build function to check and return an error for the case. Signed-off-by: SeongJae Park --- mm/damon/sysfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 767ab8c33e4d..988247d35862 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -2124,6 +2124,10 @@ static int damon_sysfs_set_targets(struct damon_ctx *ctx, { int i, err; + /* Multiple physical address space monitoring targets makes no sense */ + if (ctx->ops.id == DAMON_OPS_PADDR && sysfs_targets->nr > 1) + return -EINVAL; + for (i = 0; i < sysfs_targets->nr; i++) { struct damon_sysfs_target *sys_target = sysfs_targets->targets_arr[i]; -- 2.25.1