lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53DBA647.5050702@redhat.com>
Date:	Fri, 01 Aug 2014 16:37:59 +0200
From:	Jerome Marchand <jmarchan@...hat.com>
To:	Hugh Dickins <hughd@...gle.com>
CC:	Oleg Nesterov <oleg@...hat.com>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, linux-s390@...r.kernel.org,
	linux-doc@...r.kernel.org,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Ingo Molnar <mingo@...hat.com>,
	Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>, linux390@...ibm.com,
	Heiko Carstens <heiko.carstens@...ibm.com>,
	Martin Schwidefsky <schwidefsky@...ibm.com>,
	Randy Dunlap <rdunlap@...radead.org>
Subject: Re: [PATCH 3/5] mm, shmem: Add shmem_vma() helper

On 08/01/2014 07:03 AM, Hugh Dickins wrote:
> On Tue, 22 Jul 2014, Jerome Marchand wrote:
> 
>> Add a simple helper to check if a vm area belongs to shmem.
>>
>> Signed-off-by: Jerome Marchand <jmarchan@...hat.com>
>> ---
>>  include/linux/mm.h | 6 ++++++
>>  mm/shmem.c         | 8 ++++++++
>>  2 files changed, 14 insertions(+)
>>
>> diff --git a/include/linux/mm.h b/include/linux/mm.h
>> index 34099fa..04a58d1 100644
>> --- a/include/linux/mm.h
>> +++ b/include/linux/mm.h
>> @@ -1074,11 +1074,17 @@ int shmem_zero_setup(struct vm_area_struct *);
>>  
>>  extern int shmem_locate(struct vm_area_struct *vma, pgoff_t pgoff, int *count);
>>  bool shmem_mapping(struct address_space *mapping);
>> +bool shmem_vma(struct vm_area_struct *vma);
>> +
>>  #else
>>  static inline bool shmem_mapping(struct address_space *mapping)
>>  {
>>  	return false;
>>  }
>> +static inline bool shmem_vma(struct vm_area_struct *vma)
>> +{
>> +	return false;
>> +}
>>  #endif
> 
> I would prefer include/linux/shmem_fs.h for this (and one of us clean
> up where the declarations of shmem_zero_setup and shmem_mapping live).
> 
> But if 4/5 goes away, then there will only be one user of shmem_vma(),
> so in that case better just declare it (using shmem_mapping()) there
> in task_mmu.c in the smaps patch.
> 
>>  
>>  extern int can_do_mlock(void);
>> diff --git a/mm/shmem.c b/mm/shmem.c
>> index 8aa4892..7d16227 100644
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -1483,6 +1483,14 @@ bool shmem_mapping(struct address_space *mapping)
>>  	return mapping->backing_dev_info == &shmem_backing_dev_info;
>>  }
>>  
>> +bool shmem_vma(struct vm_area_struct *vma)
>> +{
>> +	return (vma->vm_file &&
>> +		vma->vm_file->f_dentry->d_inode->i_mapping->backing_dev_info
>> +		== &shmem_backing_dev_info);
>> +
> 
> I agree with Oleg,
> 	vma->vm_file && shmem_mapping(file_inode(vma->vm_file)->i_mapping);
> would be better,

Will do.

Jerome

> 
> Hugh
> 



Download attachment "signature.asc" of type "application/pgp-signature" (539 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ