Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4974117imm; Fri, 18 May 2018 14:04:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrZid4DpYh45KrWotzVPuwEiNDHJSuA2yJfcgxfSBGqomsL1Ln0tbmhhU78XemoZrrE/N4V X-Received: by 2002:a17:902:581:: with SMTP id f1-v6mr11154845plf.48.1526677463873; Fri, 18 May 2018 14:04:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526677463; cv=none; d=google.com; s=arc-20160816; b=yGjE3UZcv8wj6tA4/7OrVYWtTt10kSPnA1WzHtvw7m6lJ6Uuh2RKdX4ueT0yoBFytp pVS3vK8p39YA3JjR+FA0v8QQF5ryNoE8ZAxbK889Q5iQYd0/trBdhdtv+nkb/DCvjuuU feoDoBbkNYgVx9gPkaspF4Km5kWGZgdAoghMsPNzhyZWtH93wjJnoUBho1jSJDNtxPGe vpMDGxREHJNf5EsbAWTmh7Y0fwoQjnvcOqPegXTEE4hDvPf3fVlEs+zuH3wbnGZhK3zK B6uqRc7zg8as82mDFzdw4Ij4Ke/Ev3jr/TkOC0mqoG636GvzWHyrWiorVtbrsvGHqfry sEsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=BgS5fc2bg0XVpn0u+m4ssycvvz1/ozIn9e2d6yU/gLY=; b=bxwIaq34HdZtF1XY30dPLliJnFOfUTFO6LLXUWwGSgskR8IBZYDbsYmUPiZwfzeZCk PEFbXbJPIIohVZd0fVgfxyAAY8Ldf7URW4gsL4o3Cow5yj1pzl59gTfSgbxMvMhpHuxv kx+JuCbwjtgU6hIHgs/dQHqwF2wXmH1HXnde2zz5IRFCT8f8D6bIYWQO6Y8OqBn/gzXn ZmdYyBY400xGKC6sWzdqpTYl8dt86p7jV+8UURQ9dZbbq3CBEO+hld+RX57sWHa79XmV ra3xP/Zfy5VqPxiKldwKV241Mrk1+YqZMqEwqOcAKoC2lya9qjMSRgbImsg566Ih/FB+ wiGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z18-v6si8116481pfd.357.2018.05.18.14.04.09; Fri, 18 May 2018 14:04:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752073AbeERVD3 (ORCPT + 99 others); Fri, 18 May 2018 17:03:29 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46232 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751577AbeERVD1 (ORCPT ); Fri, 18 May 2018 17:03:27 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F0F040255CB; Fri, 18 May 2018 21:03:26 +0000 (UTC) Received: from localhost (unknown [10.18.25.149]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 284D710EE95E; Fri, 18 May 2018 21:03:24 +0000 (UTC) Date: Fri, 18 May 2018 17:03:23 -0400 From: Mike Snitzer To: Mikulas Patocka , Peter Zijlstra Cc: Christoph Hellwig , linux-rt-users@vger.kernel.org, Daniel Wagner , linux-kernel@vger.kernel.org, dm-devel@redhat.com, Thomas Gleixner Subject: Re: [PATCH 1/2] swait: export the symbols __prepare_to_swait and __finish_swait Message-ID: <20180518210323.GA6119@redhat.com> References: <20171123082857.GA17859@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 18 May 2018 21:03:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 18 May 2018 21:03:26 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'msnitzer@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 23 2017 at 5:27pm -0500, Mikulas Patocka wrote: > > > On Thu, 23 Nov 2017, Christoph Hellwig wrote: > > > Please run this past the swait authors. It is supposed to be a simple > > and self-contained API so I'd expect this patch to be seen critical. > > I already sent it to Peter Zijlstra and didn't get a response yet. > > > You might be better off to just use the normal complex waitqueues if > > you want to micro-optimize like this. > > If we wanted to micro-optimize, we should use the simpler wait queue > variant. > > > If these functions are not supposed to be used by others, then > - why are they in in file swait.h? > - why does the implementation export swake_up_locked which assumes that > someone else will lock the spinlock before calling it? Hi, I'd like to get this patch upstream. I'm happy to send it to Linus via linux-dm.git but I wanted to check with others who might care more deeply about swait interfaces to get their Ack (or otherwise): https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-4.18&id=4a2ec3f321f83db09da4824025420586c9ef1612 Here is Mikulas' DM driver code that makes use of __prepare_to_swait() and __finish_swait(): static int writecache_endio_thread(void *data) { struct dm_writecache *wc = data; while (1) { DECLARE_SWAITQUEUE(wait); struct list_head list; raw_spin_lock_irq(&wc->endio_thread_wait.lock); continue_locked: if (!list_empty(&wc->endio_list)) goto pop_from_list; set_current_state(TASK_INTERRUPTIBLE); __prepare_to_swait(&wc->endio_thread_wait, &wait); raw_spin_unlock_irq(&wc->endio_thread_wait.lock); if (unlikely(kthread_should_stop())) { finish_swait(&wc->endio_thread_wait, &wait); break; } schedule(); raw_spin_lock_irq(&wc->endio_thread_wait.lock); __finish_swait(&wc->endio_thread_wait, &wait); goto continue_locked; pop_from_list: list = wc->endio_list; list.next->prev = list.prev->next = &list; INIT_LIST_HEAD(&wc->endio_list); raw_spin_unlock_irq(&wc->endio_thread_wait.lock); ...