Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1125867rdb; Sat, 7 Oct 2023 13:11:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOgwq5KMUOVKrfoSz6nmmI4mGUEvgdYPVw8QFec0s6d0rbtIafkFQ3JEoPpbEQ47V3m9F7 X-Received: by 2002:a17:90b:701:b0:26b:280b:d24c with SMTP id s1-20020a17090b070100b0026b280bd24cmr10721391pjz.42.1696709474544; Sat, 07 Oct 2023 13:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696709474; cv=none; d=google.com; s=arc-20160816; b=Ne1UwZ2zeST4wVBgVTqrwb0ej8/cNdmcGT6YsRvzJJf1BsOdc4kNQmNRqa3/ao/aQ6 L4ICIBokIv6CmkbfiigmOUXBsCPx9irPd2DS8VCrc/+4TfxG2SSARwDgyn7pAPlQ+83q zNWGEa0EPoNUKMGp6g4ROGOe+mkEViMVpsrR4B9vIM7LwGPqBvkyvMcePF8zuQUXhEv8 6LwTFmHfmBoCU/kfsp+H0Dm53YvR1xtMIHbxVkuIK4O0BKhYzmz3Ar36D6qJkEDhYIUL GraXU39qK9dYSfmNZQvBRObt75Y1lltuxE1v6FzY+4RZ9gqxYSPEkkSeU7/hUvZePRzi 4oAA== 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=QhvT/v+xOgO7ppjZR4pzVQjzgc5cF+dgYIoxdPuAFgY=; fh=1uPeONJOakjQQR3EtWSq4UnIQs8xDGWx2KdW6nJr7PM=; b=P6a+CaZjNku+PmPbQCXcPOSZ9Py91QqSheZ0gD9FAZrMErLmUdRo/BarQO6b219iMU 6suxanMOOrya/VVtEE+TkPmLMMGvvm8P9IA2Mun/JtBqMA7Vd4T70T9ZMERLOIakSGZg urGhJdvVIsz4kaDJYxLNo2wkI8CvTnc+vaEr0ahJJmRaltLaJaCzdtMQH8ptKTb2Zj1H MOnGvquZ0fW6a6t9gJ+QVGWDJuJBHEJsOZj2zEuXQVVwGx8KlD4Yrs6csfH72AGcE54N iNVo6+L6AifbSmh7qy7c3PT6uw2fBBbwhMctk6xJTQccn7O3LdmPQlshw7BZkU7n6vAN 73oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Dbv8D4br; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id n17-20020a17090a929100b002676e975068si2661448pjo.1.2023.10.07.13.11.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 13:11:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Dbv8D4br; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id DAB42806E3C4; Sat, 7 Oct 2023 13:10:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344124AbjJGUKa (ORCPT + 99 others); Sat, 7 Oct 2023 16:10:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343782AbjJGUK3 (ORCPT ); Sat, 7 Oct 2023 16:10:29 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61D57BA; Sat, 7 Oct 2023 13:10:28 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80B99C433C7; Sat, 7 Oct 2023 20:10:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696709427; bh=EI+Jf8MyoFRrRMDhTXvbJDTwh+ESwYKlXTuaakRtzs0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dbv8D4brUV7WGJZolzIPMHeTV5YeDeayiREoz1J72BdJbAs8Osmyg6iRzym6AR8BM MX6vFlyHHpidaODVwIl0EF82M5nA0sj69YH8TClpwIJh7aWfRBa3rLm8rQlugexkm9 teawuemJYPXm0hS9+OWrEkw1L+PCvjNpxCBUv6PEd7BCbXPTafyWSw+YoGP0ql3Mjq TsvRiFU8BeWmog7Opy9wDzrYNY6PfMB8915xJU83Pg0wQ+hSIbyZRlpdpItKak91La /mPN5mXFSuVIxBdldqxTCtWTiHxf0u3MhpYWPEFlFpheXGLUvgvL4SGvDqZi1lhN+k VvgOU9jLJbQkQ== 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/1] mm/damon/sysfs: check DAMOS regions update progress from before_terminate() Date: Sat, 7 Oct 2023 20:10:24 +0000 Message-Id: <20231007201024.3576-1-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231007200432.3110-1-sj@kernel.org> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Sat, 07 Oct 2023 13:10:38 -0700 (PDT) X-Spam-Level: ** Hello, On Sat, 7 Oct 2023 20:04:32 +0000 SeongJae Park wrote: > DAMON_SYSFS can receive DAMOS tried regions update request while kdamond > is already out of the main loop and before_terminate callback > (damon_sysfs_before_terminate() in this case) is not yet called. And > damon_sysfs_handle_cmd() can further be finished before the callback is > invoked. Then, damon_sysfs_before_terminate() unlocks damon_sysfs_lock, > which is not locked by anyone. This happens because the callback > function assumes damon_sysfs_cmd_request_callback() should be called > before it. Check if the assumption was true before doing the unlock, to > avoid this problem. > > Fixes: f1d13cacabe1 ("mm/damon/sysfs: implement DAMOS tried regions update command") > Cc: # 6.2.x And this will not cleanly applied to 6.5.y, since this is based on latest mm-unstable tree. I will send a backport once this is merged into the mainline. Thanks, SJ [...]