From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755000AbbBJLP7 (ORCPT ); Tue, 10 Feb 2015 06:15:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45908 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751511AbbBJLP5 (ORCPT ); Tue, 10 Feb 2015 06:15:57 -0500 Date: Tue, 10 Feb 2015 12:14:11 +0100 From: Oleg Nesterov To: Darren Hart Cc: Peter Zijlstra , Thomas Gleixner , Jerome Marchand , Larry Woodman , Mateusz Guzik , LKML , dvhart@infradead.org Subject: Re: [PATCH 0/1] futex: check PF_KTHREAD rather than !p->mm to filter out kthreads Message-ID: <20150210111411.GA25614@redhat.com> References: <20150202140515.GA26398@redhat.com> <20150202151159.GE26304@twins.programming.kicks-ass.net> <20150203200916.GA10545@redhat.com> <20150204111212.GF2896@worktop.programming.kicks-ass.net> <20150204202509.GA1502@redhat.com> <20150205162725.GK5029@twins.programming.kicks-ass.net> <20150205181014.GA20244@redhat.com> <20150206104658.GI23123@twins.programming.kicks-ass.net> <20150206170425.GA7493@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Darren, On 02/09, Darren Hart wrote: > > I will prepare the test that Peter suggested so we have something to > test with now as well as run for regressions over time. Just in case, I already wrote the stupid test-case: #include #include #include #include #include #include #include #define FUTEX_LOCK_PI 6 struct robust_list { struct robust_list *next; }; struct robust_list_head { struct robust_list list; long futex_offset; struct robust_list *list_op_pending; }; int main(void) { int *mutex = mmap(NULL, 4, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_SHARED, -1,0); assert((void *)mutex != MAP_FAILED); for (;;) { int err, pid = fork(); if (!pid) { struct robust_list_head head; head.list.next = &head.list; head.futex_offset = 0; head.list_op_pending = (void *)mutex + 1; assert(syscall(__NR_set_robust_list, &head, sizeof(head)) == 0); kill(getpid(), SIGSTOP); _exit(0); } assert(waitpid(-1, NULL, WSTOPPED) == pid); *mutex = pid; kill(pid, SIGKILL); err = syscall(__NR_futex, mutex, FUTEX_LOCK_PI, 0,0,0); assert(wait(NULL) == pid); if (err) { printf("err=%d %m\n", err); kill(0, SIGKILL); } } return 0; } it needs ~20 secs to fail on my machine. Probably it can be improved. > Hrm, if we cleared the TID mask, and the pi chain is empty, can we not > clear the waiters? In this case the waiter should take care, I guess. OK. I'll try to make at least the 1st fix today (EXITING -> EXITPIDONE livelock). Oleg.