Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752761AbdHVUmR (ORCPT ); Tue, 22 Aug 2017 16:42:17 -0400 Received: from mail-oi0-f49.google.com ([209.85.218.49]:33483 "EHLO mail-oi0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752664AbdHVUmO (ORCPT ); Tue, 22 Aug 2017 16:42:14 -0400 MIME-Version: 1.0 In-Reply-To: <37D7C6CF3E00A74B8858931C1DB2F0775378A377@SHSMSX103.ccr.corp.intel.com> References: <37D7C6CF3E00A74B8858931C1DB2F0775378761B@SHSMSX103.ccr.corp.intel.com> <20170818122339.24grcbzyhnzmr4qw@techsingularity.net> <37D7C6CF3E00A74B8858931C1DB2F077537879BB@SHSMSX103.ccr.corp.intel.com> <20170818144622.oabozle26hasg5yo@techsingularity.net> <37D7C6CF3E00A74B8858931C1DB2F07753787AE4@SHSMSX103.ccr.corp.intel.com> <20170818185455.qol3st2nynfa47yc@techsingularity.net> <20170821183234.kzennaaw2zt2rbwz@techsingularity.net> <37D7C6CF3E00A74B8858931C1DB2F07753788B58@SHSMSX103.ccr.corp.intel.com> <37D7C6CF3E00A74B8858931C1DB2F0775378A24A@SHSMSX103.ccr.corp.intel.com> <37D7C6CF3E00A74B8858931C1DB2F0775378A377@SHSMSX103.ccr.corp.intel.com> From: Linus Torvalds Date: Tue, 22 Aug 2017 13:42:13 -0700 X-Google-Sender-Auth: qa-XW0uhmSPCFGuBeo3q7EyLFvw Message-ID: Subject: Re: [PATCH 1/2] sched/wait: Break up long wake list walk To: "Liang, Kan" Cc: Mel Gorman , Mel Gorman , "Kirill A. Shutemov" , Tim Chen , Peter Zijlstra , Ingo Molnar , Andi Kleen , Andrew Morton , Johannes Weiner , Jan Kara , linux-mm , Linux Kernel Mailing List Content-Type: multipart/mixed; boundary="001a113d3a32562b9405575da121" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4640 Lines: 84 --001a113d3a32562b9405575da121 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Aug 22, 2017 at 12:55 PM, Liang, Kan wrote: > >> So I propose testing the attached trivial patch. > > It doesn=E2=80=99t work. > The call stack is the same. So I would have expected the stack trace to be the same, and I would even expect the CPU usage to be fairly similar, because you'd see repeating from the callers (taking the fault again if the page is - once again - being migrated). But I was hoping that the wait queues would be shorter because the loop for the retry would be bigger. Oh well. I'm slightly out of ideas. Apparently the yield() worked ok (apart from not catching all cases), and maybe we could do a version that waits on the page bit in the non-contended case, but yields under contention? IOW, maybe this is the best we can do for now? Introducing that "wait_on_page_migration()" helper might allow us to tweak this a bit as people come up with better ideas.. And then add Tim's patch for the general worst-case just in case? Linus --001a113d3a32562b9405575da121 Content-Type: text/plain; charset="US-ASCII"; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_j6o22s610 IGluY2x1ZGUvbGludXgvcGFnZW1hcC5oIHwgNyArKysrKysrCiBtbS9maWxlbWFwLmMgICAgICAg ICAgICB8IDkgKysrKysrKysrCiBtbS9odWdlX21lbW9yeS5jICAgICAgICB8IDIgKy0KIG1tL21p Z3JhdGUuYyAgICAgICAgICAgIHwgMiArLQogNCBmaWxlcyBjaGFuZ2VkLCAxOCBpbnNlcnRpb25z KCspLCAyIGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL2luY2x1ZGUvbGludXgvcGFnZW1hcC5o IGIvaW5jbHVkZS9saW51eC9wYWdlbWFwLmgKaW5kZXggNzliMzZmNTdjM2JhLi5kMDQ1MWYyNTAx YmEgMTAwNjQ0Ci0tLSBhL2luY2x1ZGUvbGludXgvcGFnZW1hcC5oCisrKyBiL2luY2x1ZGUvbGlu dXgvcGFnZW1hcC5oCkBAIC01MDMsNiArNTAzLDcgQEAgc3RhdGljIGlubGluZSBpbnQgbG9ja19w YWdlX29yX3JldHJ5KHN0cnVjdCBwYWdlICp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