From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9698C2BB1D for ; Tue, 17 Mar 2020 11:33:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AFCE420719 for ; Tue, 17 Mar 2020 11:33:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="ghihn+qD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AFCE420719 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 438306B0005; Tue, 17 Mar 2020 07:33:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E8466B0006; Tue, 17 Mar 2020 07:33:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D8316B0007; Tue, 17 Mar 2020 07:33:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0030.hostedemail.com [216.40.44.30]) by kanga.kvack.org (Postfix) with ESMTP id 1636C6B0005 for ; Tue, 17 Mar 2020 07:33:01 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id CB5D9181AEF00 for ; Tue, 17 Mar 2020 11:33:00 +0000 (UTC) X-FDA: 76604642520.15.ghost79_71933160df91e X-HE-Tag: ghost79_71933160df91e X-Filterd-Recvd-Size: 4666 Received: from smtp-fw-6002.amazon.com (smtp-fw-6002.amazon.com [52.95.49.90]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Tue, 17 Mar 2020 11:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1584444781; x=1615980781; h=from:to:cc:subject:date:message-id:in-reply-to: mime-version; bh=izxcm8ptiZiwrpRrcuuDqsQprWd3tUq31X/9MftT3K4=; b=ghihn+qDXtlX45K+YW13P/hYkTsfyj3fTqMzm3CDRmBpHE0EKr1NViC5 JSWjXEUof7gSSuqqWkAWUG9lDkVHtwWsr9zkJbyfaJGAv/jx5mPrYyQqP H8cP7OA8/q6XgOqCFF9yrZDkecs8Z9SGZxF/L2Fl0rYN3oEhO8R2NvTev 8=; IronPort-SDR: Y9SGIQ/bR4v2R4R5Sdk5N2uvzxJZQN0lgJyP1r3JPDm5T0n49s+tVsfwcvSOK4uvwD/BS6enOQ e1BxFaHR4dZA== X-IronPort-AV: E=Sophos;i="5.70,564,1574121600"; d="scan'208";a="21384006" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1d-f273de60.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 17 Mar 2020 11:32:48 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1d-f273de60.us-east-1.amazon.com (Postfix) with ESMTPS id CCB70A05F9; Tue, 17 Mar 2020 11:32:38 +0000 (UTC) Received: from EX13D31EUA001.ant.amazon.com (10.43.165.15) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Tue, 17 Mar 2020 11:32:38 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.162.167) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 17 Mar 2020 11:32:24 +0000 From: SeongJae Park To: SeongJae Park CC: Jonathan Cameron , SeongJae Park , , SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: Re: Re: [PATCH v6 02/14] mm/damon: Implement region based sampling Date: Tue, 17 Mar 2020 12:32:05 +0100 Message-ID: <20200317113205.3617-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200313201649.26646-1-sj38.park@gmail.com> (raw) MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.162.167] X-ClientProxiedBy: EX13D31UWC004.ant.amazon.com (10.43.162.27) To EX13D31EUA001.ant.amazon.com (10.43.165.15) 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: On Fri, 13 Mar 2020 21:16:49 +0100 SeongJae Park wrote: > On Fri, 13 Mar 2020 17:29:54 +0000 Jonathan Cameron wrote: > > > On Mon, 24 Feb 2020 13:30:35 +0100 > > SeongJae Park wrote: > > > > > From: SeongJae Park > > > > > > This commit implements DAMON's basic access check and region based > > > sampling mechanisms. This change would seems make no sense, mainly > > > because it is only a part of the DAMON's logics. Following two commits > > > will make more sense. > > > > [...] > > > > Came across a minor issue inline. kthread_run calls kthread_create. > > That gives a potential sleep while atomic issue given the spin lock. > > > > Can probably be fixed by preallocating the thread then starting it later. > > > > Jonathan > [...] > > > +/* > > > + * Start or stop the kdamond > > > + * > > > + * Returns 0 if success, negative error code otherwise. > > > + */ > > > +static int damon_turn_kdamond(struct damon_ctx *ctx, bool on) > > > +{ > > > + spin_lock(&ctx->kdamond_lock); > > > + ctx->kdamond_stop = !on; > > > + if (!ctx->kdamond && on) { > > > + ctx->kdamond = kthread_run(kdamond_fn, ctx, "kdamond"); > > > > Can't do this under a spin lock. > > Good catch! And, agree to your suggestion. I will fix this in that way! I changed my mind. I would like to simply use mutex instead of spinlock, as khugepaged also does. If you have different opinion, please let me know. Thanks, SeongJae Park > > > Thanks, > SeongJae Park