From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-f200.google.com (mail-io0-f200.google.com [209.85.223.200]) by kanga.kvack.org (Postfix) with ESMTP id EB2216B0069 for ; Fri, 19 Jan 2018 13:42:20 -0500 (EST) Received: by mail-io0-f200.google.com with SMTP id e69so2669578iod.17 for ; Fri, 19 Jan 2018 10:42:20 -0800 (PST) Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id n132sor1093290ita.136.2018.01.19.10.42.19 for (Google Transport Security); Fri, 19 Jan 2018 10:42:19 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20180119125503.GA2897@bombadil.infradead.org> References: <201801170233.JDG21842.OFOJMQSHtOFFLV@I-love.SAKURA.ne.jp> <201801172008.CHH39543.FFtMHOOVSQJLFO@I-love.SAKURA.ne.jp> <201801181712.BFD13039.LtHOSVMFJQFOFO@I-love.SAKURA.ne.jp> <20180118122550.2lhsjx7hg5drcjo4@node.shutemov.name> <20180118145830.GA6406@redhat.com> <20180118165629.kpdkezarsf4qymnw@node.shutemov.name> <20180118234955.nlo55rw2qsfnavfm@node.shutemov.name> <20180119125503.GA2897@bombadil.infradead.org> From: Linus Torvalds Date: Fri, 19 Jan 2018 10:42:18 -0800 Message-ID: Subject: Re: [mm 4.15-rc8] Random oopses under memory pressure. Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org List-ID: To: Matthew Wilcox Cc: "Kirill A. Shutemov" , Peter Zijlstra , Andrea Arcangeli , Dave Hansen , Tetsuo Handa , "Kirill A. Shutemov" , Andrew Morton , Johannes Weiner , Joonsoo Kim , Mel Gorman , Tony Luck , Vlastimil Babka , Michal Hocko , "hillf.zj" , Hugh Dickins , Oleg Nesterov , Rik van Riel , Srikar Dronamraju , Vladimir Davydov , Ingo Molnar , Linux Kernel Mailing List , linux-mm , the arch/x86 maintainers On Fri, Jan 19, 2018 at 4:55 AM, Matthew Wilcox wrote: > > So really we should be casting 'b' and 'a' to uintptr_t to be fully > compliant with the spec. That's an unnecessary technicality. Any compiler that doesn't get pointer inequality testing right is not worth even worrying about. We wouldn't want to use such a compiler, because it's intentionally generating garbage just to f*ck with us. Why would you go along with that? So the only real issue is that pointer subtraction case. I actually asked (long long ago) for an optinal compiler warning for "pointer subtraction with non-power-of-2 sizes". Not because of it being undefined, but simply because it's expensive. The divide->multiply thing doesn't always work, and a real divide is really quite expensive on many architectures. We *should* be careful about it. I guess sparse could be made to warn, but I'm afraid that we have so many of these things that a warning isn't reasonable. And most of the time, a pointer difference really is inside the same array. The operation doesn't tend to make sense otherwise. Linus -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org