Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1136622ybt; Tue, 7 Jul 2020 08:33:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1onEz9zxPSqN85gIVa6D9iD68nBCa7wsHax2TEL0BMlRQcxlkyB3dzzNBgd3GIPTkXzlg X-Received: by 2002:a05:6402:a43:: with SMTP id bt3mr50855358edb.332.1594136011863; Tue, 07 Jul 2020 08:33:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594136011; cv=none; d=google.com; s=arc-20160816; b=ZFnfO7O+DF2/w9rA8GNAWXFanCnpNt2f/dPKfPPBW+tMhSk2uks3XXMTo2bK5KHg78 RQ4MWM8jO2X/OARrQ7x8h6tayJHeESH4gqecxRv+g7p2aKcOkM6IMd4nil1W2tuZTHJe nHvFj8LY31+qIIjl4yv8tHVU33DNrvxmRby7s4NtGHgY5d8Z/zP0YYSvW3ZquCTZlSNW xtel97A9w+5YER0vR/dgGzpgWdIYyz+keaNVZ+MnrAAWxmaak5JgxBT+NKxtGBxSo7my +TXeyS8/ZqSFQ8X1/uDqhoHUfaPC+X81xqMU1kTi08PpzgfcHBuJ/IKIlndvs7dDRw2K 3Y2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=fI6zyW/Q6dQ0mgMSvs1HAB1XmZOZ4PZvn8vJbh28b3s=; b=E7a+YAAvUJo+ezk8M4yyUMtdtgxIodKmkRwQHIDmHXK+BsVItzazqHrftyqShXUr8c GQ9lqaFCB5sha+e37PVDyppMNUaatXLopYcTAZMMph6A7RXvAQ7txO9vVkR8+0kq2rlt uI9OTwM/y/2SLBG2rYJ3G/LRJaxa6lO2oTW/0gObPZrtcNVxHZZT73IoqxMPlRm21Roy WTQ75nnC5URuq4p0oEqzm1tpXkU3QlBatT49Tj/ZGLI8GhFVo+yH4cK3ANOGlE5MPgXv qetXqaTB49V1gIAJcEWtQsgPg9tFGR5SsmbL4cZ5PlXPyZc+b8iuaS3+US+MXkj+3bDp qm3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MqIm4JMi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e6si14597370edq.556.2020.07.07.08.33.07; Tue, 07 Jul 2020 08:33:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MqIm4JMi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729427AbgGGPdC (ORCPT + 99 others); Tue, 7 Jul 2020 11:33:02 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:28019 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730120AbgGGPc5 (ORCPT ); Tue, 7 Jul 2020 11:32:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594135976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fI6zyW/Q6dQ0mgMSvs1HAB1XmZOZ4PZvn8vJbh28b3s=; b=MqIm4JMiikXrfVdHaAcc+wsRCjvTyKlxoX/4Ixm2+u2cyLkT1wTLj/fP0F954sedKqzWPh JzxVDsE/YaZJ3u1EzRICOA+GLT56tSLcDeIcZQ2qXeMRmYmwf1LqsBKOOrZ4EZxpXmtIb5 P1xUs/UQYr85BOv5b2XhSm+Fj9FWOh8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-48-F94UkfFIPM6ewwm_MEYMXg-1; Tue, 07 Jul 2020 11:32:52 -0400 X-MC-Unique: F94UkfFIPM6ewwm_MEYMXg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1A5BC1005510; Tue, 7 Jul 2020 15:32:51 +0000 (UTC) Received: from pick.fieldses.org (ovpn-114-172.phx2.redhat.com [10.3.114.172]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F2E2A10013D7; Tue, 7 Jul 2020 15:32:50 +0000 (UTC) Received: by pick.fieldses.org (Postfix, from userid 2815) id F26701202DC; Tue, 7 Jul 2020 11:32:49 -0400 (EDT) Date: Tue, 7 Jul 2020 11:32:49 -0400 From: "J. Bruce Fields" To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Sasha Levin , Tejun Heo Subject: Re: [PATCH 5.7 070/112] kthread: save thread function Message-ID: <20200707153249.GC171624@pick.fieldses.org> References: <20200707145800.925304888@linuxfoundation.org> <20200707145804.332402326@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200707145804.332402326@linuxfoundation.org> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org NACK to this and following patch.--b. On Tue, Jul 07, 2020 at 05:17:15PM +0200, Greg Kroah-Hartman wrote: > From: J. Bruce Fields > > [ Upstream commit 52782c92ac85c4e393eb4a903a62e6c24afa633f ] > > It's handy to keep the kthread_fn just as a unique cookie to identify > classes of kthreads. E.g. if you can verify that a given task is > running your thread_fn, then you may know what sort of type kthread_data > points to. > > We'll use this in nfsd to pass some information into the vfs. Note it > will need kthread_data() exported too. > > Original-patch-by: Tejun Heo > Signed-off-by: J. Bruce Fields > Signed-off-by: Sasha Levin > --- > include/linux/kthread.h | 1 + > kernel/kthread.c | 17 +++++++++++++++++ > 2 files changed, 18 insertions(+) > > diff --git a/include/linux/kthread.h b/include/linux/kthread.h > index 8bbcaad7ef0f4..c2a274b79c429 100644 > --- a/include/linux/kthread.h > +++ b/include/linux/kthread.h > @@ -57,6 +57,7 @@ bool kthread_should_stop(void); > bool kthread_should_park(void); > bool __kthread_should_park(struct task_struct *k); > bool kthread_freezable_should_stop(bool *was_frozen); > +void *kthread_func(struct task_struct *k); > void *kthread_data(struct task_struct *k); > void *kthread_probe_data(struct task_struct *k); > int kthread_park(struct task_struct *k); > diff --git a/kernel/kthread.c b/kernel/kthread.c > index bfbfa481be3a5..b84fc7eec0358 100644 > --- a/kernel/kthread.c > +++ b/kernel/kthread.c > @@ -46,6 +46,7 @@ struct kthread_create_info > struct kthread { > unsigned long flags; > unsigned int cpu; > + int (*threadfn)(void *); > void *data; > struct completion parked; > struct completion exited; > @@ -152,6 +153,20 @@ bool kthread_freezable_should_stop(bool *was_frozen) > } > EXPORT_SYMBOL_GPL(kthread_freezable_should_stop); > > +/** > + * kthread_func - return the function specified on kthread creation > + * @task: kthread task in question > + * > + * Returns NULL if the task is not a kthread. > + */ > +void *kthread_func(struct task_struct *task) > +{ > + if (task->flags & PF_KTHREAD) > + return to_kthread(task)->threadfn; > + return NULL; > +} > +EXPORT_SYMBOL_GPL(kthread_func); > + > /** > * kthread_data - return data value specified on kthread creation > * @task: kthread task in question > @@ -164,6 +179,7 @@ void *kthread_data(struct task_struct *task) > { > return to_kthread(task)->data; > } > +EXPORT_SYMBOL_GPL(kthread_data); > > /** > * kthread_probe_data - speculative version of kthread_data() > @@ -244,6 +260,7 @@ static int kthread(void *_create) > do_exit(-ENOMEM); > } > > + self->threadfn = threadfn; > self->data = data; > init_completion(&self->exited); > init_completion(&self->parked); > -- > 2.25.1 > > >