1. 10 Oct, 2012 2 commits
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · 72055425
      Linus Torvalds authored
      Pull btrfs update from Chris Mason:
       "This is a large pull, with the bulk of the updates coming from:
      
         - Hole punching
      
         - send/receive fixes
      
         - fsync performance
      
         - Disk format extension allowing more hardlinks inside a single
           directory (btrfs-progs patch required to enable the compat bit for
           this one)
      
        I'm cooking more unrelated RAID code, but I wanted to make sure this
        original batch makes it in.  The largest updates here are relatively
        old and have been in testing for some time."
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (121 commits)
        btrfs: init ref_index to zero in add_inode_ref
        Btrfs: remove repeated eb->pages check in, disk-io.c/csum_dirty_buffer
        Btrfs: fix page leakage
        Btrfs: do not warn_on when we cannot alloc a page for an extent buffer
        Btrfs: don't bug on enomem in readpage
        Btrfs: cleanup pages properly when ENOMEM in compression
        Btrfs: make filesystem read-only when submitting barrier fails
        Btrfs: detect corrupted filesystem after write I/O errors
        Btrfs: make compress and nodatacow mount options mutually exclusive
        btrfs: fix message printing
        Btrfs: don't bother committing delayed inode updates when fsyncing
        btrfs: move inline function code to header file
        Btrfs: remove unnecessary IS_ERR in bio_readpage_error()
        btrfs: remove unused function btrfs_insert_some_items()
        Btrfs: don't commit instead of overcommitting
        Btrfs: confirmation of value is added before trace_btrfs_get_extent() is called
        Btrfs: be smarter about dropping things from the tree log
        Btrfs: don't lookup csums for prealloc extents
        Btrfs: cache extent state when writing out dirty metadata pages
        Btrfs: do not hold the file extent leaf locked when adding extent item
        ...
      72055425
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.samba.org/sfrench/cifs-2.6 · fc81c038
      Linus Torvalds authored
      Pull CIFS fixes from Steve French.
      
      * 'for-linus' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: reinstate the forcegid option
        Convert properly UTF-8 to UTF-16
        [CIFS] WARN_ON_ONCE if kernel_sendmsg() returns -ENOSPC
      fc81c038
  2. 09 Oct, 2012 38 commits
    • Chris Mason's avatar
      f46dbe3d
    • Wang Sheng-Hui's avatar
      Btrfs: remove repeated eb->pages check in, disk-io.c/csum_dirty_buffer · 1037a5af
      Wang Sheng-Hui authored
      In csum_dirty_buffer, we first get eb from page->private.
      Then we check if the page is the first page of eb. Later
      we check it again. Remove the repeated check here.
      Signed-off-by: default avatarWang Sheng-Hui <shhuiw@gmail.com>
      1037a5af
    • Josef Bacik's avatar
      Btrfs: fix page leakage · f60b1b49
      Josef Bacik authored
      Alloc_dummy_extent_buffer will not free the first page in the eb array if we
      fail to allocate a page, fix this.  Thanks,
      Reported-by: default avatarDavid Sterba <dave@jikos.cz>
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      f60b1b49
    • Josef Bacik's avatar
      Btrfs: do not warn_on when we cannot alloc a page for an extent buffer · 4804b382
      Josef Bacik authored
      It's just annoying and the user will have gotten a nice OOM killer message
      so they are already fully aware they are screwed :).  Thanks,
      Reported-by: default avatarJérôme Poulin <jeromepoulin@gmail.com>
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      4804b382
    • Josef Bacik's avatar
      Btrfs: don't bug on enomem in readpage · edd33c99
      Josef Bacik authored
      Get rid of the BUG_ON(ret == -ENOMEM) in __extent_read_full_page.  Thanks,
      Reported-by: default avatarJérôme Poulin <jeromepoulin@gmail.com>
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      edd33c99
    • Josef Bacik's avatar
      Btrfs: cleanup pages properly when ENOMEM in compression · 15e3004a
      Josef Bacik authored
      We were freeing non-existent pages which was causing a panic for a user who
      was suffering from ENOMEM.  This patch fixes the problem.  Thanks,
      Reported-by: default avatarJérôme Poulin <jeromepoulin@gmail.com>
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      15e3004a
    • Stefan Behrens's avatar
      Btrfs: make filesystem read-only when submitting barrier fails · 5af3e8cc
      Stefan Behrens authored
      So far the return code of barrier_all_devices() is ignored, which
      means that errors are ignored. The result can be a corrupt
      filesystem which is not consistent.
      This commit adds code to evaluate the return code of
      barrier_all_devices(). The normal btrfs_error() mechanism is used to
      switch the filesystem into read-only mode when errors are detected.
      
      In order to decide whether barrier_all_devices() should return
      error or success, the number of disks that are allowed to fail the
      barrier submission is calculated. This calculation accounts for the
      worst RAID level of metadata, system and data. If single, dup or
      RAID0 is in use, a single disk error is already considered to be
      fatal. Otherwise a single disk error is tolerated.
      
      The calculation of the number of disks that are tolerated to fail
      the barrier operation is performed when the filesystem gets mounted,
      when a balance operation is started and finished, and when devices
      are added or removed.
      Signed-off-by: default avatarStefan Behrens <sbehrens@giantdisaster.de>
      5af3e8cc
    • Stefan Behrens's avatar
      Btrfs: detect corrupted filesystem after write I/O errors · 62856a9b
      Stefan Behrens authored
      In check-integrity, detect when a superblock is written that points
      to blocks that have not been written to disk due to I/O write errors.
      Signed-off-by: default avatarStefan Behrens <sbehrens@giantdisaster.de>
      62856a9b
    • Andrei Popa's avatar
      Btrfs: make compress and nodatacow mount options mutually exclusive · bedb2cca
      Andrei Popa authored
      If a filesystem is mounted with compression and then remounted by adding nodatacow,
      the compression is disabled but the compress flag is still visible.
      Also, if a filesystem is mounted with nodatacow and then remounted with compression,
      nodatacow flag is still present but it's not active.
      This patch:
      - removes compress flags and notifies that the compression has been disabled if the
        filesystem is mounted with nodatacow
      - removes nodatacow and nodatasum flags if mounted with compress.
      Signed-off-by: default avatarAndrei Popa <andrei.popa@i-neo.ro>
      bedb2cca
    • Daniel J Blueman's avatar
      btrfs: fix message printing · 48940662
      Daniel J Blueman authored
      Fix various messages to include newline and module prefix.
      Signed-off-by: default avatarDaniel J Blueman <daniel@quora.org>
      48940662
    • Josef Bacik's avatar
      Btrfs: don't bother committing delayed inode updates when fsyncing · 94edf4ae
      Josef Bacik authored
      We can just copy the in memory inode into the tree log directly, no sense in
      updating the fs tree so we can copy it into the tree log tree.  Thanks,
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      94edf4ae
    • Robin Dong's avatar
      btrfs: move inline function code to header file · 479ed9ab
      Robin Dong authored
      When building btrfs from kernel code, it will report:
      
      	fs/btrfs/extent_io.h:281: warning: 'extent_buffer_page' declared inline after being called
      	fs/btrfs/extent_io.h:281: warning: previous declaration of 'extent_buffer_page' was here
      	fs/btrfs/extent_io.h:280: warning: 'num_extent_pages' declared inline after being called
      	fs/btrfs/extent_io.h:280: warning: previous declaration of 'num_extent_pages' was here
      
      because of the wrong declaration of inline functions.
      Signed-off-by: default avatarRobin Dong <sanbai@taobao.com>
      479ed9ab
    • Tsutomu Itoh's avatar
      Btrfs: remove unnecessary IS_ERR in bio_readpage_error() · 7a2d6a64
      Tsutomu Itoh authored
      Because the value of extent_map is only a correct value or NULL,
      so IS_ERR is unnecessary.
      Signed-off-by: default avatarTsutomu Itoh <t-itoh@jp.fujitsu.com>
      7a2d6a64
    • Robin Dong's avatar
      btrfs: remove unused function btrfs_insert_some_items() · 8d1a1317
      Robin Dong authored
      The function btrfs_insert_some_items() would not be called by any other functions,
      so remove it.
      Signed-off-by: default avatarRobin Dong <sanbai@taobao.com>
      8d1a1317
    • Josef Bacik's avatar
      Btrfs: don't commit instead of overcommitting · 44734ed1
      Josef Bacik authored
      I don't think we have the same problem that this was supposed to fix
      originally since we can allocate chunks in the enospc path now.  This code
      is causing us to constantly commit the transaction as we get close to using
      all of our available space in our currently allocated chunks, instead of
      allocating another chunk and carrying on with life, which is not nice for
      performance.  Thanks,
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      44734ed1
    • Tsutomu Itoh's avatar
      Btrfs: confirmation of value is added before trace_btrfs_get_extent() is called · f0bd95ea
      Tsutomu Itoh authored
      We should confirm the value of extent_map before calling
      trace_btrfs_get_extent() because the value of extent_map has the
      possibility of NULL.
      Signed-off-by: default avatarTsutomu Itoh <t-itoh@jp.fujitsu.com>
      f0bd95ea
    • Josef Bacik's avatar
      Btrfs: be smarter about dropping things from the tree log · 18ec90d6
      Josef Bacik authored
      When we truncate existing items in the tree log we've been searching for
      each individual item and removing them.  This is unnecessary churn and
      searching, just keep track of the slot we are on and how many items we need
      to delete and delete them all at once.  Thanks,
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      18ec90d6
    • Josef Bacik's avatar
      Btrfs: don't lookup csums for prealloc extents · 6f1fed77
      Josef Bacik authored
      The tree logging stuff was looking up csums to copy over for prealloc
      extents which is just work we don't need to be doing.  Thanks,
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      6f1fed77
    • Josef Bacik's avatar
      Btrfs: cache extent state when writing out dirty metadata pages · e6138876
      Josef Bacik authored
      Everytime we write out dirty pages we search for an offset in the tree,
      convert the bits in the state, and then when we wait we search for the
      offset again and clear the bits.  So for every dirty range in the io tree we
      are doing 4 rb searches, which is suboptimal.  With this patch we are only
      doing 2 searches for every cycle (modulo weird things happening).  Thanks,
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      e6138876
    • Josef Bacik's avatar
      Btrfs: do not hold the file extent leaf locked when adding extent item · ce195332
      Josef Bacik authored
      For some reason we unlock everything except the leaf we are on, set the path
      blocking and then add the extent item for the extent we just finished
      writing.  I can't for the life of me figure out why we would want to do
      this, and the history doesn't really indicate that there was a real reason
      for it, so just remove it.  This will reduce our tree lock contention on
      heavy writes.  Thanks,
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      ce195332
    • Josef Bacik's avatar
      Btrfs: do not async metadata csumming in certain situations · de0022b9
      Josef Bacik authored
      There are a coule scenarios where farming metadata csumming off to an async
      thread doesn't help.  The first is if our processor supports crc32c, in
      which case the csumming will be fast and so the overhead of the async model
      is not worth the cost.  The other case is for our tree log.  We will be
      making that stuff dirty and writing it out and waiting for it immediately.
      Even with software crc32c this gives me a ~15% increase in speed with O_SYNC
      workloads.  Thanks,
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      de0022b9
    • Zach Brown's avatar
      btrfs: fix min csum item size warnings in 32bit · 221b8318
      Zach Brown authored
      commit 7ca4be45 limited csum items to
      PAGE_CACHE_SIZE.  It used min() with incompatible types in 32bit which
      generates warnings:
      
      fs/btrfs/file-item.c: In function ‘btrfs_csum_file_blocks’:
      fs/btrfs/file-item.c:717: warning: comparison of distinct pointer types lacks a cast
      
      This uses min_t(u32,) to fix the warnings.  u32 seemed reasonable
      because btrfs_root->leafsize is u32 and PAGE_CACHE_SIZE is unsigned
      long.
      Signed-off-by: default avatarZach Brown <zab@zabbo.net>
      221b8318
    • Josef Bacik's avatar
      Btrfs: run delayed refs first when out of space · 67b0fd63
      Josef Bacik authored
      Running delayed refs is faster than running delalloc, so lets do that first
      to try and reclaim space.  This makes my fs_mark test about 20% faster.
      Thanks,
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      67b0fd63
    • Miao Xie's avatar
      Btrfs: fix orphan transaction on the freezed filesystem · 354aa0fb
      Miao Xie authored
      With the following debug patch:
      
       static int btrfs_freeze(struct super_block *sb)
       {
      + 	struct btrfs_fs_info *fs_info = btrfs_sb(sb);
      +	struct btrfs_transaction *trans;
      +
      +	spin_lock(&fs_info->trans_lock);
      +	trans = fs_info->running_transaction;
      +	if (trans) {
      +		printk("Transid %llu, use_count %d, num_writer %d\n",
      +			trans->transid, atomic_read(&trans->use_count),
      +			atomic_read(&trans->num_writers));
      +	}
      +	spin_unlock(&fs_info->trans_lock);
       	return 0;
       }
      
      I found there was a orphan transaction after the freeze operation was done.
      
      It is because the transaction may not be committed when the transaction handle
      end even though it is the last handle of the current transaction. This design
      avoid committing the transaction frequently, but also introduce the above
      problem.
      
      So I add btrfs_attach_transaction() which can catch the current transaction
      and commit it. If there is no transaction, it will return ENOENT, and do not
      anything.
      
      This function also can be used to instead of btrfs_join_transaction_freeze()
      because it don't increase the writer counter and don't start a new transaction,
      so it also can fix the deadlock between sync and freeze.
      
      Besides that, it is used to instead of btrfs_join_transaction() in
      transaction_kthread(), because if there is no transaction, the transaction
      kthread needn't anything.
      Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
      354aa0fb
    • Miao Xie's avatar
      Btrfs: add a type field for the transaction handle · a698d075
      Miao Xie authored
      This patch add a type field into the transaction handle structure,
      in this way, we needn't implement various end-transaction functions
      and can make the code more simple and readable.
      Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
      a698d075
    • Miao Xie's avatar
      Btrfs: fix memory leak in start_transaction() · e8830e60
      Miao Xie authored
      This patch fixes memory leak of the transaction handle which happened
      when starting transaction failed on a freezed fs.
      Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
      e8830e60
    • Mark Fasheh's avatar
      btrfs: extended inode ref iteration · d24bec3a
      Mark Fasheh authored
      The iterate_irefs in backref.c is used to build path components from inode
      refs. This patch adds code to iterate extended refs as well.
      
      I had modify the callback function signature to abstract out some of the
      differences between ref structures. iref_to_path() also needed similar
      changes.
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.de>
      d24bec3a
    • Mark Fasheh's avatar
      btrfs: extended inode refs · f186373f
      Mark Fasheh authored
      This patch adds basic support for extended inode refs. This includes support
      for link and unlink of the refs, which basically gets us support for rename
      as well.
      
      Inode creation does not need changing - extended refs are only added after
      the ref array is full.
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.de>
      f186373f
    • Linus Torvalds's avatar
      Fix staging driver use of VM_RESERVED · 547b1e81
      Linus Torvalds authored
      The VM_RESERVED flag was killed off in commit 314e51b9 ("mm: kill
      vma flag VM_RESERVED and mm->reserved_vm counter"), and replaced by the
      proper semantic flags (eg "don't core-dump" etc).  But there was a new
      use of VM_RESERVED that got missed by the merge.
      
      Fix the remaining use of VM_RESERVED in the vfio_pci driver, replacing
      the VM_RESERVED flag with VM_DONTEXPAND | VM_DONTDUMP.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation,org>
      547b1e81
    • Linus Torvalds's avatar
      Merge branch 'akpm' (Andrew's patch-bomb) · 9e2d8656
      Linus Torvalds authored
      Merge patches from Andrew Morton:
       "A few misc things and very nearly all of the MM tree.  A tremendous
        amount of stuff (again), including a significant rbtree library
        rework."
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (160 commits)
        sparc64: Support transparent huge pages.
        mm: thp: Use more portable PMD clearing sequenece in zap_huge_pmd().
        mm: Add and use update_mmu_cache_pmd() in transparent huge page code.
        sparc64: Document PGD and PMD layout.
        sparc64: Eliminate PTE table memory wastage.
        sparc64: Halve the size of PTE tables
        sparc64: Only support 4MB huge pages and 8KB base pages.
        memory-hotplug: suppress "Trying to free nonexistent resource <XXXXXXXXXXXXXXXX-YYYYYYYYYYYYYYYY>" warning
        mm: memcg: clean up mm_match_cgroup() signature
        mm: document PageHuge somewhat
        mm: use %pK for /proc/vmallocinfo
        mm, thp: fix mlock statistics
        mm, thp: fix mapped pages avoiding unevictable list on mlock
        memory-hotplug: update memory block's state and notify userspace
        memory-hotplug: preparation to notify memory block's state at memory hot remove
        mm: avoid section mismatch warning for memblock_type_name
        make GFP_NOTRACK definition unconditional
        cma: decrease cc.nr_migratepages after reclaiming pagelist
        CMA: migrate mlocked pages
        kpageflags: fix wrong KPF_THP on non-huge compound pages
        ...
      9e2d8656
    • David Miller's avatar
      sparc64: Support transparent huge pages. · 9e695d2e
      David Miller authored
      This is relatively easy since PMD's now cover exactly 4MB of memory.
      
      Our PMD entries are 32-bits each, so we use a special encoding.  The
      lowest bit, PMD_ISHUGE, determines the interpretation.  This is possible
      because sparc64's page tables are purely software entities so we can use
      whatever encoding scheme we want.  We just have to make the TLB miss
      assembler page table walkers aware of the layout.
      
      set_pmd_at() works much like set_pte_at() but it has to operate in two
      page from a table of non-huge PTEs, so we have to queue up TLB flushes
      based upon what mappings are valid in the PTE table.  In the second regime
      we are going from huge-page to non-huge-page, and in that case we need
      only queue up a single TLB flush to push out the huge page mapping.
      
      We still have 5 bits remaining in the huge PMD encoding so we can very
      likely support any new pieces of THP state tracking that might get added
      in the future.
      
      With lots of help from Johannes Weiner.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9e695d2e
    • David Miller's avatar
      mm: thp: Use more portable PMD clearing sequenece in zap_huge_pmd(). · f5c8ad47
      David Miller authored
      Invalidation sequences are handled in various ways on various
      architectures.
      
      One way, which sparc64 uses, is to let the set_*_at() functions accumulate
      pending flushes into a per-cpu array.  Then the flush_tlb_range() et al.
      calls process the pending TLB flushes.
      
      In this regime, the __tlb_remove_*tlb_entry() implementations are
      essentially NOPs.
      
      The canonical PTE zap in mm/memory.c is:
      
      			ptent = ptep_get_and_clear_full(mm, addr, pte,
      							tlb->fullmm);
      			tlb_remove_tlb_entry(tlb, pte, addr);
      
      With a subsequent tlb_flush_mmu() if needed.
      
      Mirror this in the THP PMD zapping using:
      
      		orig_pmd = pmdp_get_and_clear(tlb->mm, addr, pmd);
      		page = pmd_page(orig_pmd);
      		tlb_remove_pmd_tlb_entry(tlb, pmd, addr);
      
      And we properly accomodate TLB flush mechanims like the one described
      above.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f5c8ad47
    • David Miller's avatar
      mm: Add and use update_mmu_cache_pmd() in transparent huge page code. · b113da65
      David Miller authored
      The transparent huge page code passes a PMD pointer in as the third
      argument of update_mmu_cache(), which expects a PTE pointer.
      
      This never got noticed because X86 implements update_mmu_cache() as a
      macro and thus we don't get any type checking, and X86 is the only
      architecture which supports transparent huge pages currently.
      
      Before other architectures can support transparent huge pages properly we
      need to add a new interface which will take a PMD pointer as the third
      argument rather than a PTE pointer.
      
      [akpm@linux-foundation.org: implement update_mm_cache_pmd() for s390]
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b113da65
    • David Miller's avatar
      sparc64: Document PGD and PMD layout. · dbc9fdf0
      David Miller authored
      We're going to be messing around with the PMD interpretation and layout
      for the sake of transparent huge pages, so we better clearly document what
      we're starting with.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      dbc9fdf0
    • David Miller's avatar
      sparc64: Eliminate PTE table memory wastage. · c460bec7
      David Miller authored
      We've split up the PTE tables so that they take up half a page instead of
      a full page.  This is in order to facilitate transparent huge page
      support, which works much better if our PMDs cover 4MB instead of 8MB.
      
      What we do is have a one-behind cache for PTE table allocations in the
      mm struct.
      
      This logic triggers only on allocations.  For example, we don't try to
      keep track of free'd up page table blocks in the style that the s390 port
      does.
      
      There were only two slightly annoying aspects to this change:
      
      1) Changing pgtable_t to be a "pte_t *".  There's all of this special
         logic in the TLB free paths that needed adjustments, as did the
         PMD populate interfaces.
      
      2) init_new_context() needs to zap the pointer, since the mm struct
         just gets copied from the parent on fork.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c460bec7
    • David Miller's avatar
      sparc64: Halve the size of PTE tables · 56a70b8c
      David Miller authored
      The reason we want to do this is to facilitate transparent huge page
      support.
      
      Right now PMD's cover 8MB of address space, and our huge page size is 4MB.
       The current transparent hugepage support is not able to handle HPAGE_SIZE
      != PMD_SIZE.
      
      So make PTE tables be sized to half of a page instead of a full page.
      
      We can still map properly the whole supported virtual address range which
      on sparc64 requires 44 bits.  Add a compile time CPP test which ensures
      that this requirement is always met.
      
      There is a minor inefficiency added by this change.  We only use half of
      the page for PTE tables.  It's not trivial to use only half of the page
      yet still get all of the pgtable_page_{ctor,dtor}() stuff working
      properly.  It is doable, and that will come in a subsequent change.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      56a70b8c
    • David Miller's avatar
      sparc64: Only support 4MB huge pages and 8KB base pages. · 15b9350a
      David Miller authored
      Narrowing the scope of the page size configurations will make the
      transparent hugepage changes much simpler.
      
      In the end what we really want to do is have the kernel support multiple
      huge page sizes and use whatever is appropriate as the context dictactes.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      15b9350a
    • Yasuaki Ishimatsu's avatar
      memory-hotplug: suppress "Trying to free nonexistent resource... · d760afd4
      Yasuaki Ishimatsu authored
      memory-hotplug: suppress "Trying to free nonexistent resource <XXXXXXXXXXXXXXXX-YYYYYYYYYYYYYYYY>" warning
      
      When our x86 box calls __remove_pages(), release_mem_region() shows many
      warnings.  And x86 box cannot unregister iomem_resource.
      
        "Trying to free nonexistent resource <XXXXXXXXXXXXXXXX-YYYYYYYYYYYYYYYY>"
      
      release_mem_region() has been changed to be called in each
      PAGES_PER_SECTION by commit de7f0cba ("memory hotplug: release
      memory regions in PAGES_PER_SECTION chunks").  Because powerpc registers
      iomem_resource in each PAGES_PER_SECTION chunk.  But when I hot add
      memory on x86 box, iomem_resource is register in each _CRS not
      PAGES_PER_SECTION chunk.  So x86 box unregisters iomem_resource.
      
      The patch fixes the problem.
      Signed-off-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Jiang Liu <liuj97@gmail.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Minchan Kim <minchan.kim@gmail.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Wen Congyang <wency@cn.fujitsu.com>
      Cc: Dave Hansen <dave@linux.vnet.ibm.com>
      Cc: Nathan Fontenot <nfont@austin.ibm.com>
      Cc: Badari Pulavarty <pbadari@us.ibm.com>
      Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d760afd4