diff mbox series

[4/5] mm/vma: Replace all remaining open encodings with vma_set_anonymous()

Message ID 1581915833-21984-5-git-send-email-anshuman.khandual@arm.com (mailing list archive)
State New, archived
Headers show
Series mm/vma: Use available wrappers when possible | expand

Commit Message

Anshuman Khandual Feb. 17, 2020, 5:03 a.m. UTC
This replaces all remaining open encodings with vma_set_anonymous().

Cc: Sudeep Dutt <sudeep.dutt@intel.com>
Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Allison Randal <allison@lohutok.net>
Cc: Richard Fontana <rfontana@redhat.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 drivers/misc/mic/scif/scif_mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kirill A . Shutemov Feb. 17, 2020, 10:27 a.m. UTC | #1
On Mon, Feb 17, 2020 at 10:33:52AM +0530, Anshuman Khandual wrote:
> This replaces all remaining open encodings with vma_set_anonymous().
> 
> Cc: Sudeep Dutt <sudeep.dutt@intel.com>
> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Kate Stewart <kstewart@linuxfoundation.org>
> Cc: Allison Randal <allison@lohutok.net>
> Cc: Richard Fontana <rfontana@redhat.com>
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  drivers/misc/mic/scif/scif_mmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/mic/scif/scif_mmap.c b/drivers/misc/mic/scif/scif_mmap.c
> index a151d416f39c..1f0dec5df994 100644
> --- a/drivers/misc/mic/scif/scif_mmap.c
> +++ b/drivers/misc/mic/scif/scif_mmap.c
> @@ -580,7 +580,7 @@ static void scif_munmap(struct vm_area_struct *vma)
>  	 * The kernel probably zeroes these out but we still want
>  	 * to clean up our own mess just in case.
>  	 */
> -	vma->vm_ops = NULL;
> +	vma_set_anonymous(vma);
>  	vma->vm_private_data = NULL;
>  	kref_put(&vmapvt->ref, vma_pvt_release);
>  	scif_delete_vma(ep, vma);

This is misleading. The VMA doesn't become anonymous here. This is undo of
the previously overwritten vm_ops. I think we should leave it opencodded.
Anshuman Khandual Feb. 17, 2020, 11:56 a.m. UTC | #2
On 02/17/2020 03:57 PM, Kirill A. Shutemov wrote:
> On Mon, Feb 17, 2020 at 10:33:52AM +0530, Anshuman Khandual wrote:
>> This replaces all remaining open encodings with vma_set_anonymous().
>>
>> Cc: Sudeep Dutt <sudeep.dutt@intel.com>
>> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Kate Stewart <kstewart@linuxfoundation.org>
>> Cc: Allison Randal <allison@lohutok.net>
>> Cc: Richard Fontana <rfontana@redhat.com>
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>>  drivers/misc/mic/scif/scif_mmap.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/misc/mic/scif/scif_mmap.c b/drivers/misc/mic/scif/scif_mmap.c
>> index a151d416f39c..1f0dec5df994 100644
>> --- a/drivers/misc/mic/scif/scif_mmap.c
>> +++ b/drivers/misc/mic/scif/scif_mmap.c
>> @@ -580,7 +580,7 @@ static void scif_munmap(struct vm_area_struct *vma)
>>  	 * The kernel probably zeroes these out but we still want
>>  	 * to clean up our own mess just in case.
>>  	 */
>> -	vma->vm_ops = NULL;
>> +	vma_set_anonymous(vma);
>>  	vma->vm_private_data = NULL;
>>  	kref_put(&vmapvt->ref, vma_pvt_release);
>>  	scif_delete_vma(ep, vma);
> 
> This is misleading. The VMA doesn't become anonymous here. This is undo of
> the previously overwritten vm_ops. I think we should leave it opencodded.

I was bit unsure about it as well, thanks for the clarification. Will drop it.
Greg Kroah-Hartman March 18, 2020, 10:24 a.m. UTC | #3
On Mon, Feb 17, 2020 at 10:33:52AM +0530, Anshuman Khandual wrote:
> This replaces all remaining open encodings with vma_set_anonymous().
> 
> Cc: Sudeep Dutt <sudeep.dutt@intel.com>
> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Kate Stewart <kstewart@linuxfoundation.org>
> Cc: Allison Randal <allison@lohutok.net>
> Cc: Richard Fontana <rfontana@redhat.com>
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  drivers/misc/mic/scif/scif_mmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

The subject line does not match up with the file being modified here :(
Anshuman Khandual March 18, 2020, 10:41 a.m. UTC | #4
On 03/18/2020 03:54 PM, Greg Kroah-Hartman wrote:
> On Mon, Feb 17, 2020 at 10:33:52AM +0530, Anshuman Khandual wrote:
>> This replaces all remaining open encodings with vma_set_anonymous().
>>
>> Cc: Sudeep Dutt <sudeep.dutt@intel.com>
>> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Kate Stewart <kstewart@linuxfoundation.org>
>> Cc: Allison Randal <allison@lohutok.net>
>> Cc: Richard Fontana <rfontana@redhat.com>
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>>  drivers/misc/mic/scif/scif_mmap.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> The subject line does not match up with the file being modified here :(

Idea here was to primarily focus on the VMA modifying helpers instead,
hence the subject line. But I get your point and agree that it was bit
off the mark. Anyways, had already dropped this patch.
diff mbox series

Patch

diff --git a/drivers/misc/mic/scif/scif_mmap.c b/drivers/misc/mic/scif/scif_mmap.c
index a151d416f39c..1f0dec5df994 100644
--- a/drivers/misc/mic/scif/scif_mmap.c
+++ b/drivers/misc/mic/scif/scif_mmap.c
@@ -580,7 +580,7 @@  static void scif_munmap(struct vm_area_struct *vma)
 	 * The kernel probably zeroes these out but we still want
 	 * to clean up our own mess just in case.
 	 */
-	vma->vm_ops = NULL;
+	vma_set_anonymous(vma);
 	vma->vm_private_data = NULL;
 	kref_put(&vmapvt->ref, vma_pvt_release);
 	scif_delete_vma(ep, vma);