Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964883AbdHYXDz (ORCPT ); Fri, 25 Aug 2017 19:03:55 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:34416 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964822AbdHYXDy (ORCPT ); Fri, 25 Aug 2017 19:03:54 -0400 MIME-Version: 1.0 In-Reply-To: References: <83f675ad385d67760da4b99cd95ee912ca7c0b44.1503677178.git.tim.c.chen@linux.intel.com> From: Linus Torvalds Date: Fri, 25 Aug 2017 16:03:50 -0700 X-Google-Sender-Auth: ABGnIlN7MAGfVvigEYKAynEzPwE Message-ID: Subject: Re: [PATCH 2/2 v2] sched/wait: Introduce lock breaker in wake_up_page_bit To: Tim Chen Cc: Mel Gorman , Peter Zijlstra , Ingo Molnar , Andi Kleen , Kan Liang , Andrew Morton , Johannes Weiner , Jan Kara , Christopher Lameter , "Eric W . Biederman" , Davidlohr Bueso , linux-mm , Linux Kernel Mailing List Content-Type: multipart/mixed; boundary="001a113d0a8a79c49005579bf59f" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 18939 Lines: 264 --001a113d0a8a79c49005579bf59f Content-Type: text/plain; charset="UTF-8" On Fri, Aug 25, 2017 at 3:51 PM, Linus Torvalds wrote: > > So take it as that: example pseudo-code that happens to pass a > compiler, but is meant as a RFD rather than actually working. Oh, and after I sent it out, I wanted to look once again, and realized that the "remove_myself_from()" function is entirely broken. The caller has already removed the page entry, we don't want to remove it again, we want to add a *new* one with us removed from it. So here's an updated 2/2 patch with that fixed. Let this be a lesson in just *how* little tested, and *how* crap that patch probably still is. Linus --001a113d0a8a79c49005579bf59f Content-Type: text/x-patch; charset="US-ASCII"; name="0002-Re-implement-the-page-bit-wait-code.patch" Content-Disposition: attachment; filename="0002-Re-implement-the-page-bit-wait-code.patch" Content-Transfer-Encoding: base64 X-Attachment-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