Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3245019imm; Sun, 17 Jun 2018 14:57:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLNuLEAYxOGON7wIJJDveRWCgdNs7vyE/6XunqUT8LM63cDqAeH2zb6P+4OvxnXP/ofXDmQ X-Received: by 2002:a17:902:bd42:: with SMTP id b2-v6mr11316730plx.23.1529272677630; Sun, 17 Jun 2018 14:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529272677; cv=none; d=google.com; s=arc-20160816; b=tvstJ00j0jBKjggbHwuRq33V11YraNatQOfMVewQ9Kd3aVN4uEVWq4MEDIosiBW+Ej 2Eh8imiTb9CxduL9N6r0dZdciEz/gmhmzo+OWVSTuFFBK0sHH1Sczwu1eJlqWFOLLGL9 gBH3blz0P/lEbDceqYuhzxR5QSbIirGDREquZrjl78FgHmMRAvMgib2758ZbNHyAg2e5 3sg195Qe3amilKeNhRufUNl63pyzE1oJoOqNHlI4HhtRxKyXOmXkNoF1Y6Jc5fTH8Cfv miS5cTsGe3Zfb/I0HRjQEBrU5rz4llVx3aFuaFGq7jz+FABivsnh1VHSOQ8pPn4H847z SSiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=wYY+h80vAnUTTrDsL0DASx7v1lZSPozQM7VnO5xZ5Mk=; b=moWTf4q7CMMq2O5xegUywgJe7Se1cC4ZzjFQMlnZYbbXmq/c1BYexV5YXRrfuSunBv Pa0xMn5FrxIZepGBQ5GzwpX+lAw3uPl6pofiVaayQpbpYdTrssVo3VpwPSiCBQK219PS q1YRzjAWW/drFoAg9oMQBvSeS9wYtdIWsimtxA74w8IZjQZReh+9U2kHvG69Yexi/Gg1 Pzq47BNqFFX/UtmPkvraL4/0gRVmIJXM3x1ID/doabmsoDwvQJfkVi2OHaAbKAooEHPs wyGv4cPg8LVk9kJgUdF1rK/q9HANeqZ+fwqW9ekgubh+82v7HqDitkHzMZu2+5Yor0Da cu6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=JEsLqsKx; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d16-v6si13347374pll.197.2018.06.17.14.57.30; Sun, 17 Jun 2018 14:57:57 -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; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=JEsLqsKx; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752915AbeFQVyd (ORCPT + 99 others); Sun, 17 Jun 2018 17:54:33 -0400 Received: from a9-99.smtp-out.amazonses.com ([54.240.9.99]:48590 "EHLO a9-99.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752699AbeFQVyc (ORCPT ); Sun, 17 Jun 2018 17:54:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1529272471; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:Feedback-ID; bh=wYY+h80vAnUTTrDsL0DASx7v1lZSPozQM7VnO5xZ5Mk=; b=JEsLqsKxtMZahXr5XChj8ODlgSgjjE/NTWWHeGgFyyDt/NgWbmaLii9wKsVUvBAf HFkW7WyTPn+Bt5Jv07AMlSgJSid6LGFNKcyCVbXB1A/fI0OhODpHLVRGkrtgDY6eq3x rTQYEuLHtlJSI9K7Y78NCkh2pVFY6KEjiLNW49TQ= Date: Sun, 17 Jun 2018 21:54:31 +0000 From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: john.hubbard@gmail.com cc: Matthew Wilcox , Michal Hocko , Jason Gunthorpe , Dan Williams , Jan Kara , linux-mm@kvack.org, LKML , linux-rdma , John Hubbard Subject: Re: [PATCH 0/2] mm: gup: don't unmap or drop filesystem buffers In-Reply-To: <20180617012510.20139-1-jhubbard@nvidia.com> Message-ID: <010001640fbe0dd8-f999e7f6-7b6e-4deb-b073-0c572006727d-000000@email.amazonses.com> References: <20180617012510.20139-1-jhubbard@nvidia.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SES-Outgoing: 2018.06.17-54.240.9.99 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 16 Jun 2018, john.hubbard@gmail.com wrote: > I've come up with what I claim is a simple, robust fix, but...I'm > presuming to burn a struct page flag, and limit it to 64-bit arches, in > order to get there. Given that the problem is old (Jason Gunthorpe noted > that RDMA has been living with this problem since 2005), I think it's > worth it. > > Leaving the new page flag set "nearly forever" is not great, but on the > other hand, once the page is actually freed, the flag does get cleared. > It seems like an acceptable tradeoff, given that we only get one bit > (and are lucky to even have that). This is not robust. Multiple processes may register a page with the RDMA subsystem. How do you decide when to clear the flag? I think you would need an additional refcount for the number of times the page was registered. I still think the cleanest solution here is to require mmu notifier callbacks and to not pin the page in the first place. If a NIC does not support a hardware mmu then it can still simulate it in software by holding off the ummapping the mmu notifier callback until any pending operation is complete and then invalidate the mapping so that future operations require a remapping (or refaulting).